Because $p$ is different from $2$, the solutions are the same as direct sum decompositions $\mathbb{Z}_p^{\oplus n} = E_{+1} \oplus E_{-1}$ as $\mathbb{Z}_p$-vector spaces. You can index these by the dimensions, say $r$ and $n-r$. For each, the number of solutions is $$ \frac{(p^n-1)(p^n-p) \cdot \dots \cdot (p^n-p^{r-1})}{(p^r-1)(p^r-p) \cdot \dots \cdot (p^r-p^{r-1})} \cdot p^{r(n-r)} $$ So the final answer is the sum over $r$ from $0$ to $n$ of this factor.
Jason Starr
- 4.1k
- 1
- 93
- 111