How to construct the set E invoving an almost constant function? Assume that $f$ is a function from $\mathbb{R}$ to $\mathbb{R}$, and for all $h\in \mathbb{R}$, the set $E_h=\{x:f(x+h)-f(x)\neq 0,x\in \mathbb{R}\}$ is a finite set which has no more than 2016 elements.  Prove that there exists a set $E$ which has no more than $1008$ elements, such that $f$ is a constant in $\mathbb{R}\backslash E$.
To solve this problem, I think it needs a keen observation.  What I have thought is first to prove $f(\mathbb{R})$ have no more than 1008 elements, but it is hard for me.  How can I do this?

Let $x_m=min(E_1)+1$ and $x_M=max(E_1)$.
We claim that $f(x)=f(x_m-1)$ for all $x<x_m$. In fact, assume by contradiction that $x<x_m$ and $f(x)\ne f(x_m-1)$. Then $f(x)=f(x-n)$ for all $n\in\Bbb{N}$, since otherwise $f(x-j)\ne f(x-j-1)$ for some $j\in\Bbb{N}_0$ and then $x-j-1\in E_1$, but $x-j-1<x_m-1=min(E_1)$. Similarly $f(x_m-1)=f(x_m-1-n)$ for all $n\in\Bbb{N}$. 
But then  $x-n\in E_h$ for $h=x_m-1-x$ and $n\in \Bbb N$, since
$$
f(x-n)=f(x)\ne f(x_m-1)=f(x_m-1-n)=f(x-n+h),
$$
and this is impossible, since $E_h$ is finite, and so we have proven the claim.
Similarly one proves that $f(x)=f(x_M+1)$ for all $x>x_M$. 
So $f(x)=c$ for $x<x_m$ and $f(x)=C$ for $x>x_M$. But if $c\ne C$, then for $h>x_M-x_m$ we would have infinitely many $x\in E_h$, so $c=C$.
Consequently $f(x)=c$ for all $x$ outside the interval $[x_m,x_M]$. 
Now take $h$ sufficiently big, for example take $h=3(x_M-x_m)$. 
Then $f(x)\ne c$ for some $x\in [x_m,x_M]$, if and only if $x,x-h\in E_h$. Since there are at most 2016 elements in $E_h$, there are at most 1008 elements  $x$ such that $f(x)\ne c$.
