2. Given that for every pair of real numbers $x, y$, the function $f$ satisfies $f(x)+f(y)=f(x+y)-x y-1$. If $f(1)=1$, then the number of integers $n$ that satisfy $f(n)=n$ is $(\quad)$.
(A) 1
(B) 2
(C) 3
(D) infinitely many
2.B.

Let $y=1$ we get $f(x)+f(1)=f(x+1)-x-1$, i.e., $f(x+1)=f(x)+x+2$.
Let $x=0$ we get $f(1)=f(0)+2$.
From $f(1)=1$ we know $f(0)=-1$.
When $n \in \mathbf{N}_{+}$,
$$
\begin{array}{l}
f(n)=\sum_{k=1}^{n}[f(k)-f(k-1)]+f(0) \\
=\sum_{k=1}^{n}(k+1)+f(0)=\frac{n(n+3)}{2}-1 .
\end{array}
$$

Similarly, $f(-n)=-\frac{n(-n+3)}{2}-1$.
Therefore, $f(n)=\frac{n(n+3)}{2}-1, n \in \mathbf{Z}$.
Let $f(n)=n$, solving we get $n=-2$ or $n=1$.