4. Find all values of the real parameter $a$ for which the equation

$$
a x^{2}-(a+2) x+(a+1)=0
$$

has two distinct real solutions greater than 1.
4. For the solutions to be real and distinct, the discriminant of the considered equation must be positive, so we have $0 < \frac{a+2-\sqrt{4-3 a^{2}}}{2 a}$, which means we need to satisfy the condition $\frac{a+2-\sqrt{4-3 a^{2}}}{2 a} > 1$. After multiplying this inequality by $2a$ (which does not change the sign), it can be transformed into $2-a > \sqrt{4-3 a^{2}}$. From there, we immediately get $a < 2$ and $4-3 a^{2} \geq 0$, i.e., $4 a^{2} > 4 a$, which simplifies to $a > 1$. Now, let's assume that $a$ is negative. Then we have $\frac{a+2-\sqrt{4-3 a^{2}}}{2 a} > \frac{a+2+\sqrt{4-3 a^{2}}}{2 a}$, so we need to satisfy the condition $\frac{a+2+\sqrt{4-3 a^{2}}}{2 a} > 1$. Multiplying this inequality by $2a$ (which now changes the sign of the inequality) gives us $2 + \sqrt{4-3 a^{2}} < a$, but this is a contradiction because the left side is positive and the right side is negative, so this case is impossible.

Therefore, taking everything into account, the solution to the problem is: $a \in \left(1, \frac{2}{\sqrt{3}}\right)$.