Let $f$ be a continuous function from $[0,1]$ to set of $n\times n$ matrices i.e. $M(n\times n,\mathbb{R})$ such that $f(t)^2=f(t)$ for all $t$. Then $f(t)$ has a constant rank for all $t$.
The only thing that I was able to guess conclude here that $f(t)$ has two eigenvalues, namely $0$ and $1$ with the minimal polynomial $x^2-x$, as if the minimal polynomial is $x$ or $x-1$, we are done.
Now what to do afterwards?
Take the trace of $f(t)$. It's continuous on the one hand and it is the sum of the eigenvalue $1$'s on the other hand, which is just the rank of $f(t) $.