Let $G$ be a nonabelian group of order $p^{3},$ where $p$ is a prime. Show that $G$ has exactly $p^{2}+p-1$ distinct conjugacy classes. Problem

Let $G$ be a nonabelian group of order $p^{3},$ where $p$ is a prime.  Show that $G$ has exactly $p^{2}+p-1$ distinct conjugacy classes.

Attempt

Let $G$ be a nonabelian group with $|G|=p^{3},$ where $p$ is a prime. Recall $|Z(G)|=p$ from the previous problem (1)[I've prove already]. By Class equation, 
  \begin{equation} \label{5 - 1}
p^{3}=|G|=|Z(G)|+\sum_{i=1}^{n}[G:C(a_i)]=p+\sum_{i=1}^{n}[G:C(a_i)],
\end{equation}
  where ${\rm class~}a_1$, ${\rm class~}a_2$, $\cdots$, ${\rm class~}a_n$ are the nonsingleton conjugacy classes in $G$. It is enough to show that $n=p^2-1$.
Since $2 \leq\left[G: C\left(a_{i}\right)\right]=\frac{|G|}{|C(a_i)|}=\frac{p^3}{|C(a_i)|},$ we have 
  $$
| C\left(a_{i}\right)|=1{\rm ~or~}p{\rm ~or~}p^2{\rm ~or~p^3}
$$
  for each $i=1,2,\cdots, n$. Note that $| C\left(a_{i}\right)|\neq 1$ for all $i$ since $G$ is nonabelian and $| C\left(a_{i}\right)|\neq p^3$ for all $i$ because $|Z(G)|=p$. Assume that there is $j \in N$ such that $|C\left(a_{j}\right)|=p$. Then 
  $$
\left| \frac{G}{C(a_j)}\right|=\frac{|G|}{|C(a_j)|}=\frac{p^3}{p}=p^2.
$$
  Hence, $G/C(a_j)$ is abelian. Then -----??------, which is a contradiction. Hence, $|C\left(a_{i}\right)|=p^2$ for all $i$. 
  ---------skip--------------

Question


*

*Am I approaching in the right way?

*If good, how to prove the '-----??------'. 

 A: $\newcommand{\Span}[1]{\left\langle #1 \right\rangle}$You might try this argument. If $a \in G \setminus Z(G)$, then $C_{G}(a) < G$, so $C_{G}(a)$ has order less than $p^{3}$. Now $\Span{Z(G), a}$ has order at least $p^{2}$, as $a \notin Z(G)$, and $\Span{Z(G), a} \le C_{G}(a)$.
A: The conjugacy classes are the orbits of the action of $G$ on itself by conjugation. Then, by the Burnside Lemma we have:
\begin{alignat}{1}
|\mathcal{O}| &= \frac{1}{|G|}\sum_{g\in G}|\operatorname{Stab}(g)| \\
&= \frac{1}{|G|}\sum_{g\in G}|C_G(g)| \\
&= \frac{1}{|G|}\Bigl(\sum_{g\in Z(G)}|C_G(g)|+\sum_{g\in G\setminus Z(G)}|C_G(g)|\Bigr) \\
\tag 1
\end{alignat}
Now, $g \in Z(G) \Rightarrow C_G(g)=G \Rightarrow |C_G(g)|=|G|$, while $g \in G\setminus Z(G) \Rightarrow |C_G(g)|<|G|$; but, for nonabelian groups, $Z(G)$ is a proper subgroup of all the centralizers, which then for noncentral elements must all have order $p^2$. Therefore $(1)$ reads:
\begin{alignat}{1}
|\mathcal{O}| &= \frac{1}{p^3}\Bigl(p p^3+(p^3-p)p^2\Bigr) \\
&= p+p^2-1
\tag 2
\end{alignat}
A: Because $\mathcal Z(G)\subset\mathcal C(a_i)\neq G$ we must have $p$ $|$ $|\mathcal C(a_i)|$ $|$ $p^3$. Therefore $|\mathcal C(a_i)|=p^2$. $$\therefore p^3=p+np$$ $$\therefore n=p^2-1$$ 
