Find the number of subgroups of order $p$

Let $G$ be a finite abelian group of order $p^n$, where $p$ is a prime number. How to find the number of subgroups of order $p$?

i.e. find a formula for the number of subgroups of order $p$.

I know that $G$ is isomorphic to a direct product of cyclic $p$-groups. There are too many cases. I don't know the appropriate approach. It seems that there should be a formula that works universally.

-
How will your formula distinguish between, say, $\mathbf Z/4\mathbf Z$ and $\mathbf Z/2\mathbf Z \times \mathbf Z/2\mathbf Z$? –  Dylan Moreland Mar 5 '12 at 23:29
You could start by computing the number of subgroups of order $p$ in $\mathbb{Z}/p^k \mathbb{Z}$, and then use the fact $G$ is a product of such groups (from the classification of finite abelian groups)). –  Joel Cohen Mar 5 '12 at 23:29

The number will have the form $\frac{p^{r}-1}{p-1},$ where $r$ is an integer betwen $1$ and $n.$ All of these possibilities can occur. The integer $r$ is the number of cyclic factors when $G$ is expressed as a direct product of cyclic groups. The elements of order $p$ in $G$ (together with the identity) form a subgroup $H$ of order $p^r,$ and this subgroup contains $\frac{p^{r}-1}{p-1}$ subgroups of order $p$ (no two subgroups of order $p$ have a non-identity element in common, and each of the $p^{r}-1$ non-identity elements of order $p$ in $H$ lie in a subgroup of $H$ of order $p$).