Problem

Source: Caucasus MO 2023

Tags:



Numbers $1, 2,\ldots, n$ are written on the board. By one move, we replace some two numbers $ a, b$ with the number $a^2-b{}$. Find all $n{}$ such that after $n-1$ moves it is possible to obtain $0$.