Let $R=\mathbb{Z}_p[x]/(x^p-x)$. Show that $R$ has exactly $2^p$ elements satisfying $r^2=r$.
I know that for $f,g\in\mathbb{Z}_p[x]$, we have $f-g\in(x^p-x)$ if and only if $f(a)=g(a)$ for all $a\in\mathbb{Z}_p$. It follows that $r^2=r\in R$ if and only if $r$ is represented by some $f\in\mathbb{Z}_p[x]$ such that $f(a)^2=f(a)$ for all $a\in\mathbb{Z}_p$. Thus, it must follow that $f(a)=0$ or $f(a)=1$ for each $a$.
Now, for each of the $2^p$ $p$-tuples $(b_0,\ldots,b_{p-1})$ where each $b_i$ is either $0$ or $1$, does there exist a polynomial $f$ such that $f(a)=b_a$, and is this polynomial uniquely defined in $R$?
Each of the $p$ elements of the field $\mathbb{Z}_p$ is a root of the polynomial $q(x) = x^p - x$. Thus we have a factorization of $q(x)$ into $p$ distinct irreducible factors: $$q(x) = x (x-1) \cdots (x-(p-1)).$$ By the Chinese Remainder Theorem, we therefore have a ring isomorphism $$\mathbb{Z}_p[x]/(x^p - x) \cong \mathbb{Z}_p[x]/(x) \times \mathbb{Z}_p[x]/(x-1) \times \cdots \times \mathbb{Z}_p[x]/(x-(p-1)) \cong (\mathbb{Z}_p)^p.$$
It's now much easier to compute the number of idempotents of this ring. I'll leave the rest of the fun to you!