Bohdan against "tails"#18

Bohdan against "tails" (Editorial)

Problem Author:

Pavlo Tsitsei

Prepared by:

Pavlo Tsitsei, Feysa Bohdan

Editorial by:

Pavlo Tsitsei

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