Problem statement has been updated again. Step #4 has been changed.
The statement of problem C has been updated. Step #9 has been changed.
Have you ever heard the quote "Everyone is a slave to something" before?
It goes like: In the grand scheme of things, most people tend to have desires that rule their life, shape their goals, and control their actions.. Whether it's the desire for money, fame, power, or even virtue; we end up doing what flows with that desire, what we originally tied ourselves to.
You might agree, you might not.. But nevertheless, dear participant, the one thing that we can know for sure at this point of time, is that $\textbf{you}$ sir (or madam), are the slave in this problem.
In this problem we have designed here, we will be providing you with an array $a$ of non-negative integers of length $n$, and will be asking you to perform a series of operations on it, fifteen precise steps, if you may; in order to test your resolve, evaluate your patience, and most importantly.. Waste your time.
Without further ado, please, perform these fifteen steps on the provided array:
The first line of input will contain an integer $n$ $(1 \le n \le 10^5)$ --- the length of the original array.
The second line will contain $n$ space-separated integers $(0 \le a_i \le n)$ --- the values of the array $a$.
Output one integer, the value described in step $15$, after carefully executing the given procedure.
Input | Output |
---|---|
1 1 Copy
|
55 Copy
|
8 4 7 8 2 7 2 3 3 Copy
|
12834 Copy
|