In *How to recognize constant functions. Connections with Sobolev spaces* (Russian Math Surveys **57** (2002); MSN), H. Brezis recalls the following fact:

Let $\Omega\subset{\mathbb R}^N$ be connected and $f:\Omega\rightarrow{\mathbb R}$ be measurable, such that $$\int\int_{\Omega\times\Omega}\frac{|f(y)-f(x)|}{|y-x|^{N+1}}\,dx\,dy<\infty.$$ Then $f$ is constant.

He adds

The conclusion is easy to state, but I do not know a direct, elementary, proof. Our proof is not very complicated but requires an “excursion” via the Sobolev spaces.

My question is whether there is such an elementary proof in the special case of one space dimension ($N=1$, $\Omega$ an interval).