For how many values of $a$ is it true that the line $y = x + a$ passes through the vertex of the parabola $y = x^2 + a^2$?
The vertex of the parabola is $(0, a^2)$. The line passes through the vertex if and only if  $a^2 = 0 + a$. There are $\boxed{2}$ solutions to this equation, namely $a = 0$ and $a = 1$.