Rubaev I.S.

What is the maximum finite number of roots that the equation

$$
\left|x-a_{1}\right|+. .+|x-a 50|=\left|x-b_{1}\right|+. .+|x-b 50|
$$

can have, where $a_{1}, a_{2}, \ldots, a_{50}, b_{1}, b_{2}, \ldots, b_{50}$ are distinct numbers?
Let $f(x)=\left|x-a_{1}\right|+\ldots+|x-a 50|-\left|x-b_{1}\right|-. .-|x-b 50|$ and rewrite the original equation in the form $f(x)=0$.

Let $c_{1}<c_{2}<. .<c 100$ be all the numbers from the set $\left\{a_{1}, . ., a 50, b_{1}, . ., b 50\right\}$, ordered in ascending order. On each of the 101 intervals $\left[-\boldsymbol{\infty}, c_{1}\right],\left[c_{1}, c_{2}\right],[c 99, c 100],[c 100,+\infty)$, the function $f(x)$ is linear. Note that on the first and last of these intervals, $f(x)=m=\left(a_{1}+\ldots+a 50\right)-\left(b_{1}+\ldots+b 50\right)$ and $f(x)=-m$ respectively, and $m \neq 0$, since the number of roots is finite.

We will move along the number line from left to right.

Initially, the slope of the function $f(x)$ is 0. Every time we pass one of the points $c_{i}$, it changes by $\pm 2$ due to the change in the sign when opening the corresponding modulus.

Thus, it is always an even integer and cannot change sign without first becoming 0.

This means that the slopes on any two adjacent intervals are either both non-negative or both non-positive, i.e., the function $f(x)$ on the union of these intervals is either non-decreasing or non-increasing.

Therefore, if the number of its roots is finite, then on each of the 50 segments $\left[c_{1}, c_{3}\right], \ldots, [c97,c99], [c99,c100]$, it has no more than one root. Moreover, on the extreme intervals, the values have different signs, and at each root, the sign of the function changes. Consequently, the number of roots is odd and does not exceed 49.

It is not difficult to verify that if the role of $a_{i}$ is played by the numbers $1,4,5,8,97,100$, and the role of $b_{i}$ by the numbers $2,3,6,7,94,95,98$,

$99 \frac{1}{10}$, then the equation $f(x)=0$ will have exactly 49 roots.

## Answer

49.00