\begin{enumerate}
\item ($1$ point): all $a_i$ are the same;
\item ($3$ points): $a_i = a_{i+2}$ for all $1 \le i \le n-2$;
\item ($9$ points): $n \le 20$;
\item ($8$ points): $n \le 5000$;
\item ($9$ points): $r - l \le 10$;
\item ($10$ points): $l = 1, r \le 10^6$;
\item ($13$ points): $r \le 10^6$;
\item ($10$ points): $l = 1$;
\item ($24$ points): $n \le 10^5$;
\item ($13$ points): no additional constraints.
\end{enumerate}