Can we find a continuous function from $\mathbb{R}$ to $\mathbb{R}$ that has fixed points at $kn^2$ for every integer $k$ and every prime number $n$? And other points other than these are not fixed points? - this eliminates the case like $f(x)=x$.
It is also fine to slightly relax the condition and allow the set of fixed points to have numbers that are real numbers, but not integers.
You can consider the set $A=\{ kn^2\}_{k \in \mathbb{N}, \textit{n prime}}$ which is discrete and totally ordered so can be thought as $A=\{a_m\}$ and the set $B= \{\frac{a_m+a_{m+1}}{2} \}$ consisting of the points being in the middle of the points of $A$. Now you define the function that is $f(x)= x $ if $ x \in A$, $f(x)=x+1$ if $x \in B$ and is linear everywhere else. If $g(x)=x$, then it is clear that $f(x) \geq g(x)$ and equality holds only for $x \in A$.