Consider a general polynomial $g$ of degree $m,$ $m>0.$ Let
$$
g(x) = a_m x^m + a_{m-1} x^{m-1} + \cdots + a_0,
$$
where $ a_m \neq 0.$
Then
\begin{align}
g(x + 1) &= a_m (x+1)^m + a_{m-1} (x+1)^{m-1} + \cdots + a_0 \\
&= a_m\left(x^m + mx^{m-1} + \cdots + 1\right)
+ a_{m-1}\left(x^{m-1} + \cdots + 1\right) + \cdots + a_0 \\
&= a_m x^m + \left(ma_m + a_{m-1}\right)x^{m-1} + \cdots + b_0,
\end{align}
where $b_0$ is a constant and all the terms not shown (the terms in the "$\cdots$") are terms of degree $m-2$ or less.
We see that $g(x+1)$ is also a polynomial of degree $m.$
A similar calculation shows that $g(x-1)$ is a polynomial of degree $m$;
by induction, so is $g(x+k)$ for any integer $k$, although that's
more than we need to know for this particular problem.
Taking the difference
\begin{align}
g(x + 1) - g(x)
&= a_m x^m + \left(ma_m + a_{m-1}\right)x^{m-1} + \cdots + b_0 \\
& \quad - a_m x^m + a_{m-1} x^{m-1} + \cdots +a_0 \\
&= ma_m x^{m-1} + \cdots + (b_0 - a_0), \\
\end{align}
which is a polynomial of degree $m-1,$ since $m >0$ and $a_m \neq 0.$
That is, in general, where $g$ is a polynomial of positive degree $m,$
the difference $g(x + 1) - g(x)$ is a polynomial of degree $m-1.$
Let $h(x) = g(x) - g(x-1).$
Since $g(x-1)$ is a polynomial of degree $m,$
$$h(x) = g((x+1) - 1) - g(x-1)$$
is a polynomial of degree $m-1.$
If $m=1$ then $h(x)$ is a constant, so $h(x+1) = h(x) = 0$;
but if $m > 1$ then
$$h(x+1) - h(x) = (g(x+1) - g(x)) - (g(x) - g(x-1))
= g(x+1) - 2g(x) + g(x-1)$$
is a polynomial of degree $m-2.$
I have written the facts above in terms of some arbitrary polynomial $g,$
rather than the less general polynomial $f$ in your problem,
to show that this method of differences is generally applicable.
Now let's apply it to your particular question.
Consider $f_2(x) = f(x+1) - 2f(x) + f(x-1),$ where $f$ is the polynomial of degree $n$ in the question. It is given that
$$1+f(x)=\frac{f(x-1)+f(x+1)}{2},$$
from which it follows that $f_2(x) = 2,$
that is, $f_2$ has degree $0.$
If $n = 0$ or $n = 1,$ we would have $f_2(x)=0,$
which is a contradiction;
therefore $n \geq 2$ and $f_2$ has degree $n-2.$
Combining the two statements about the degree of
$f_2,$ the degree of $f_2$ is $n - 2 = 0.$
Therefore $n=2.$