# 5. CONDITION

$n$ integers are written in a circle, the sum of which is 94. It is known that any number is equal to the absolute value of the difference of the two numbers following it. Find all possible values of $n$.
Solution. From the condition, it follows that all the recorded numbers are non-negative. Let $a$ be the largest of these numbers (if there are several, then we choose any one of them), and $b, c, d, e$ be the next numbers in the circle. Then $a=|b-c|$, which is possible only if one of the numbers $b$ or $c$ equals $a$, and the other equals 0. If $b=a, c=0$, then from the equality $b=|c-d|$ it follows that $d=a$. From the equality $c=|d-e|$, it follows that $e=a$, and so on. If, however, $b=0$ and $c=a$, then similarly $d=a, e=0$, and so on. Thus, $n$ is divisible by $3, n=3m$, and the recorded numbers are as follows: $a, a, 0$, $a, a, 0, \ldots, a, a, 0$. Their sum is $2ma$. From the equality $2ma=94$ it follows that $ma=47$, i.e., $m=47, a=1$ or $m=1, a=47$, from which $n=141$ or $n=3$.

Answer: $n=3$ or $n=141$.