Let $f:[0,n]\to \Bbb R$ be continuous with $f(0)=f(n)$. Then there are $n$ pairs of numbers $x,y$ such that $f(x)=f(y)$ and $y-x\in\Bbb N$.
Really a long comment: Define $g_k(x)=f(x+k)-f(x)$. We observe that $g_k$ is continuous since $f$ is continuous. Proof (somewhat) by induction on $n$.
When $n=1$, the result is trivial.
When $n=2$, consider $g_1(0)$ and $g_1(1)$. $g_1(1)=f(2)-f(1)=f(0)-f(1)=-g_1(0)$. Therefore, $g_1$ must either be identically zero or change signs. If $g_1$ is identically zero, then $f$ is constant, and, in particular, $f(1)=f(0)$, so $(0,1)$ and $(1,2)$ forms pairs of distance $1$.
When $n=3$, consider $g_2(0)$ and $g_2(1)$. $g_2(0)=f(2)-f(0)=f(2)-f(3)=-g_1(2)$. In addition, $g_2(1)=f(3)-f(1)=f(0)-f(1)=-g_1(0)$. If $g_2$ does not change signs, then both $g_2(0)$ and $g_2(1)$ have the same sign. This means that $g_1(0)$ and $g_1(2)$ have the same sign.
We note that since $f(3)=f(0)+g_1(0)+g_1(1)+g_1(2)$, it follows that $g_1(0)+g_1(1)+g_1(2)=0$, so either all $g_1(i)$'s are zero or $g_1$ changes sign at least once. Since $g_1(0)$ and $g_1(2)$ have the same sign, then we know that $g_1(1)$ has the opposite sign and the sign of $g_1$ changes at least twice, giving two pairs of points at distance $1$.
Note also, that if there is a pair of distance $n-1$, then we can use induction to prove the result.
Perhaps the $n=3$ case can be further generalized.
EDIT: The general case has been proven by me here.
Answer for a very special case:
Proposition. Let $f:[0,n]\to\Bbb R$ be a continuous function such that
- $f(0)=f(n)$ and
- $f$ is convex or concave.
Then there are $n$ pairs $(x,y)$ such that $y-x\in\Bbb N$ and $f(x)=f(y)$.
Proof.
By induction (over $n$):
Start ($n=1$): Trivial.
Step: Suppose that the lemma is true for some $n$. Let $f$ be a function as in the lemma for $n+1$. Define $g(x):= f(x+n)-f(x)$ for $x\in[0,1]$.
If $f$ is convex, then we have $f\big(0\cdot(1-t)+(n+1)\cdot t\big)\le (1-t)\cdot f(0)+t\cdot f(n+1)=f(0)$ for all $t\in[0,1]$. So $f(x)\le f(0)$ for all $x\in[0,n]$. Hence $g(0)=f(n)-f(0)\le 0$ and $g(1)=f(n+1)-f(1)=f(0)-f(1)\geq 0$. It follows from the Intermediate Value Theorem ($g$ is continuous) that $g(x_0)=0$ i.e. $f(x_0+n)=f(x_0)$ for some $x_0\in[0,1]$. Now we can conclude using the inductive hypothesis on $f|_{[x_0,x_0+n]}$ (the latter being a translation of a function that satisfies all assumptions of the Proposition.)
If $f$ is concave then we have $f(x)\geq f(0)$ for all $x$ and we continue as above.
Here is a full proof. For $i=1,\dots, n$ and $x\in [0,n-i]$ define $g_i(x):= f(x+i)-f(x)$. Then all the $g_i$ satisfy (on their respective domains): \begin{gather} \tag 1 \label 1 \sum_{j=0}^n g_1(j)=0,\\ \tag 2 \label 2 g_i(x)=g_1(x+i-1)+g_1(x+i-2)+\dots+g_1(x)=\sum_{j=0}^{i-1}g_1(x+j). \end{gather}
Define for all $i=1,\dots,n$ and $j=1,\dots, n-i+1$: $$a_{i,j} = g_i(j-1).$$
By the Proposition proven by me here, there are at least $n$ distinct pairs $(i,j)$ with $i\in\{1,\dots, n\}$ and $j\in\{1,\dots,n-i+1\}$ such that
- $a_{i,j}=0$ or
- $j\le n-i$ and $a_{i,j}\cdot a_{i,j+1} < 0$.
In the first case, we have $g_i(j-1)=f(j-1+i)-f(j-1)=0$ leading to a pair $(x,y)$ as wanted.
In the second case, we have $g_i(j-1)\cdot g_i(j)<0$. We can apply the Intermediate Value Theorem to get that there exists and $x\in[j-1,j]$ such that $g_i(x)=f(x+i)-f(x)=0$. This also leads to a pair $(x,y)$ as wanted.
Since all the $(x,y)$ gotten by the above procedure are different for different $(i,j)$, we conclude that there are at least $n$ distinct pairs $(x,y)$ such that $f(x)=f(y)$ and $y-x\in\Bbb N$.