In this problem, there are conditional blocks. If your solution works correctly for certain constraints, it will receive a certain number of points. Note that the evaluation is still in progress.

\begin{enumerate}
\item ($32$ points): the number of different numbers among all $a_i$ is not more than $2$;
\item ($33$ points): $n\le 1\,000$;
\item ($35$ points): without additional constraints.
\end{enumerate}