Let us check that the answer to the first example is consistent with the given numbers $a_i$.

\begin{enumerate}
\item Runner $1$ has upset runners $2$, $4$, and $5$.
\item Runner $2$ took the last place and, therefore, has not outperformed anyone.
Hence, runner $2$ has performed no upsets.
\item The runner with the number $3$ took the first place and, therefore, has upset both runners with larger numbers.
\item The runner with the number $4$ has upset a single other runner: runner $5$.
\item There are no runners with numbers larger than $5$.
Therefore, runner $5$ has performed no upsets.
\end{enumerate}
