The reducibility of a polynomial in coefficients of integer

This question is from Putnam and Beyond, an example in the section ‘Irreducible Polynomial’:

Let $P(x)$ be an nth-degree polynomial with integer coefficients with the property
that $|P(x)|$ is a prime number for $2n + 1$ distinct integer values of the variable $x$.
Prove that $P(x)$ is irreducible over $mathbb{Z}[x]$.

And the solution:
Assume the contrary and let $P(x) = Q(x)R(x)$ with $Q(x),R(x) ∈ mathbb{Z}[x]$,
$Q(x),R(x) = ±1$. Let $k = deg(Q(x))$. Then $Q(x) = 1$ at most $k$ times and $Q(x) =
−1$ at most $n − k$ times. Also, $R(x) = 1$ at most $n − k$ times and $R(x) = −1$ at
most $k$ times. Consequently, the product $|Q(x)R(x)|$ is composite except for at most
$k + (n − k) + (n − k) + k = 2n$ values of $x$. This contradicts the hypothesis. Hence
$P(x)$ is irreducible.

All concept is okay for me except the part “$Q(x)=-1$ at most $n-k$ times” , because I know $Q(x)=1$ at most $k$ times is because $Q(x)$ will be constant function if $Q=1$ at least $k+1$ times, but is it related to $Q(x)=-1$?

All topic