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?

Observation: If $x\in E_h$ then $x+h\in E_h$. So if $x$ is a member of $E_h$ then at least one of the endpoints of $h$-neighborhood must be in $E_h$. By choosing $h$ appropriately we can have only one of it $h$. So for each $x$ we can associate one of the endpoints. 
Fix $h$. Suppose we enumerate $E_h$ from small to big. That is 
$$
E_h=\{x_1, x_2, \dots x_r  \}
$$
where $x_1<x_2\dots<x_r$. Note that we have $f(x_1+nh)=f(x_1)$ for $x_1+nh<x $ for all $n\in \mathbb{Z}$. 
To understand this, consider the first point on the left of $x_1$ with a distance $h$. Call it $x^\prime$. If $f(x^\prime)\neq f(x_1)$ then $x^\prime \in E_h$ which contradicts with the fact that $x_1$ being minimum of $E_h$. Now take the point, say $x^{\prime\prime}$ on the left of $x^\prime$ with a distance $h$ i.e., so the distance between this point and $x_1$ is $2h$. Similarly, $f(x^\prime)=f(x^{\prime\prime})$, otherwise we have contradiction. Proceeding similar way we have the statement.
Now we claim that for any $x_1<x<x_2$ we have $f(x_1)=f(x)$. If not, then we have $f(x_1)\neq f(x)$. Now, let $\delta=x-x_1$ and note that $\mid\delta \mid <\mid h\mid$. First note any point on the left of $x$ with a distance $nh$ for some $n\in\mathbb{Z}$, it has the same value with $x$. That is, for $x+nh<x$ we have $f(x)=f(x+nh)$. If not, $x_1$ is not minimum of $E_h$ which contradiction.  Consider $E_\delta$ and note that 
$$
f(x_1+nh)=f(x_1) \text{ for all } x_1+nh<x_1 \\
f(x+nh)=f(x) \text{ for all } x+nh<x, \text{ and }\\
f(x)\neq f(x_1)
$$
This implies that we will have countable set of points in the form of $x_1+nh<x_1$ and $x+nh<x$ in $E_\delta$ which contradicts finiteness of $E_\delta$. This implies that $f(x)=f(x_1)$ for all $_1<x< x_2$, which then implies $f(t)=f(x_1)$ for all $t< x_2$.
Repeating these arguments we can see that $f$ is constant on the right hand side of maximum and finally $f$ is constant on $\mathbb{R}\setminus E_h$. Choose $h$ so that you can have Observation satisfied so that $E$ has $\leq 1008$ elements.
