Showing $|G|=p^r \Rightarrow |G| \equiv |Z(G)| \pmod{p}$ If $|G|=p^r$, then $|G| \equiv |Z(G)| \pmod{p}$

I think it's enough to show that $\sum_{|o(x)>1|}|G:st(x)|=np, n\in\mathbb{N}$  and use the proposal $|G|=|Z(G)|+ \sum_{|o(x)>1|}|G:st(G)|, $ then we get  $|G| \equiv |Z(G)| \pmod{p}$
(Here $st(x)$ is the stabilizer of $x$, and $o(x)$ is the orbit of $x$.)
Now because $|G|=|st(x)|| o(x)|$ we get that $|st(x)|$ divides the order of $G$, so it must divide $p^r$, and we can say it's of the form $p^m, m< r$, hence it will also divide $p^{r-1}$
Now  $\sum_{|o(x)>1|}|G:st(x)|=\frac{p^r}{p^{m_1}}+\dots +\frac{p^r}{p^{m_n}}=p\left(\frac{p^{r-1}}{p^{m_1}}+\dots +\frac{p^{r-1}}{p^{m_n}}\right)=pn$
Is this correct, is there an easier and more intuitive way to prove it?

We want to prove that if $|G|=p^n$ then $p||Z(G)$.
If $G=Z(G)$ we're done so assume $G\neq Z(G)$. By the class equation we get:
$|G|=|Z(G)|+\sum|G:C_G(g_i)|$ for every $g_i\not\in Z(G)$. $p||G:C_G(gi)|$ and also $p||G|$ so by isolating $|Z(G)|$ we see that $p||Z(G)|$.
