4. The number of all integer solutions to the equation $\left(x^{2}+x-1\right)^{x+3}=1$ is ( ).
(A) 2
(B) 3
(C) 4
(D) 5
4. C

Translate the text above into English, please retain the original text's line breaks and format, and output the translation result directly.