4. In the sequence $\left\{a_{n}\right\}$, $a_{0}=2, a_{n}=a_{n-1}-n+3, n \geqslant 1$, then $a_{n}=$
4. $-\frac{n(n+1)}{2}+3 n+2$.

The above text has been translated into English, maintaining the original text's line breaks and format.