subgroups of $p$-groups and elementary $p$-groups Let $G$ be a $p$-group and $A$ an elementary $p$-group. Suppose that $\sharp G=\sharp A$, where $\sharp (-)$ denotes the order of $(-)$. Write $C_{d}(G)$ (resp. $C_{d}(A)$) for the cardinality of the set of subgroups of $G$ (resp. $A$) whose order are equal to $d$.
My question is that $C_{d}(G) \leq C_{d}(A)$?
 A: Yes. Moreover, assuming that $d$ is a power of $p$ and $p<d<|G|$, we have equality iff $G$ is elementary (Edit: for $d=p$ there's equality iff $G$ is $p$-torsion). I denote by $C_d(H)$ the set of subgroups of $H$ of order $d$ and $c_d(H)$ its cardinal.
Indeed, fix a central subgroup $Z$ of order $p$ in $G$. Let $C_d^Z(G)$ (resp. $C_d^{(Z)}(G))$ the set of subgroups of order $d$ containing $Z$ (resp. not containing $Z$). If $H$ is a subgroup of $G/Z$, let $C_d^{(Z,H)}(G)$ be the set of $L\in C_d^{(Z)}(G)$ whose projection on $G/Z$ is $H$. Let $C^{Z}_d[G/Z]$ be the set of $H\in C_d(G/Z)$ for which $C_d^{(Z,H)}(G)\neq\emptyset$. If $H\in C^{Z}_d[G/Z]$, then there is a natural bijection from $C_d^{(Z,H)}(G)$ to $\mathrm{Hom}(H,Z)$. Again, I use small $c$ to denote the cardinal of these sets. Denote $G^*=G/(G^p[G,G])$. 
Then, assuming that $p$ divides $d$ (since the case $d=1$ is trivial) 
$$\begin{align*}
c_d(G)&=c_d^Z(G)+c_d^{(Z)}(G)\\
&=c_{d/p}^Z(G/Z)+c_d^{(Z)}(G)\\
&=c_{d/p}^Z(G/Z)+\sum_{H\in C_d^{Z}[G/Z]}c_d^{(Z,H)}(G)\\
&=c_{d/p}^Z(G/Z)+\sum_{H\in C_d^{Z}[G/Z]}\#(\mathrm{Hom}(H^*,Z)).
\end{align*}$$
So 
$$\begin{align*}
c_d(G)&\le c_{d/p}^Z(G/Z)+\sum_{H\in C_d^{Z}[G/Z]}\#(\mathrm{Hom}((G/Z)^*,Z))\\
&=c_{d/p}^Z(G/Z)+c_d^{Z}[G/Z]\#(\mathrm{Hom}((G/Z)^*,Z))\\
&\le c_{d/p}^Z(G/Z)+c_d(G/Z)\#(\mathrm{Hom}((G/Z)^*,Z));
\end{align*}$$
by induction we have $c_{d/p}^Z(G/Z)\le c_{d/p}^Z(A/Z)$, so 
$$c_d(G)\le c_{d/p}^Z(A/Z) + c_d(G/Z)\#(\mathrm{Hom}((G/Z)^*,Z)),$$
and the latter is just the same count for $c_d(A)$. So $c_d(G)\le c_d(A)$. 
Now consider the case of equality. The special case when $d=p$ is immediate (but I was not careful in the correct statement in my first post!), so assume $d$ is a power of $p$ and $p<d<|G|$.
Then we have $c_d^Z[G/Z]=c_d(A/Z)$, which in particular means that $G/Z$ has as many subgroups of order $d$ than $A/Z$. If $d<|G|/p$, this implies by induction that $G/Z$ is elementary.
Hence the commutator defines a $(\mathbf{Z}/p\mathbf{Z})$-bilinear alternating form on $G/Z$ valued in $Z$, and we can find for every $d=p^b\in [p^2,|G|/p]$ a subgroup of order $d$ which cannot be lifted, unless $G$ is abelian. Finally, if $G$ is abelian and some generator of $Z$ is a $p$-power, we can also find subgroups of order $d$ that cannot be lifted; otherwise $Z$ is a direct factor and $G$ is elementary.
Now consider the case $d=|G|/p$. Then $C_d(G)$ is the set of kernels of homomorphisms from $G$ onto $Z$ and has cardinal equal to $(|G/[G,G]G^p|-1)/(p-1)$, which is equal to that in the case of $A$ (namely $(|A|-1)/(p-1)$ if and only if $G$ is elementary abelian (this is the case of G. Robinson's comment).
