\begin{tutorial}{Bohdan against "tails"}

\begin{center}
\begin{tabular}{rl}
\textbf{Problem Author}: & \textbf{Pavlo Tsitsei} \\
\textbf{Prepared by}: & \textbf{Pavlo Tsitsei, Feysa Bohdan} \\
\textbf{Editorial by}: & \textbf{Pavlo Tsitsei} 
\end{tabular} 
\end{center}

The solution is to simulate the process described in the statement. That is, considering the element $i$, it is necessary to add to the answer $max(\lfloor \frac{x}{2^k}\rfloor ,1)$ where $k$ is the number of elements $j<i$ such that $a_i=a_j$.

\end{tutorial}
