Eigenvalues and eigenspaces of a matrix with a given property

Suppose A is a real n×n matrix that satisfies A2v=2Av for every v∈Rn.
(a) Show that the only possible eigenvalues of A are 0 and 2.
(b) For each λ∈R, let Eλ denote the λ-eigenspace of A, i.e., Eλ={v∈Rn∣Av=λv}. Prove that Rn=E0⊕E2. (Hint: For every vector v one can write v=(v−12Av)+12Av.)