4. Given the equation in $x$
$$
(a-1) x^{2}+2 x-a-1=0
$$

has roots that are all integers. Then the number of integer values of $a$ that satisfy this condition is
$\qquad$.
4.5.

When $a=1$, $x=1$.
When $a \neq 1$, it is easy to see that $x=1$ is an integer root of the equation.
Furthermore, from $1+x=\frac{2}{1-a}$ and $x$ being an integer, we know
$$
1-a= \pm 1, \pm 2 \text {. }
$$

Therefore, $a=-1,0,2,3$.
In summary, there are 5 integer values of $a$ that satisfy the condition.