Cossack Vus recently discovered an array with elements, where each element is either a zero or a one.
He is curious to know: what is the minimum number of swaps between adjacent elements required to sort this array?
The first line contains a single integer (1 \le n \le 10^6) — the length of the array .
The second line contains integers a_1, a_2, \dots, a_n (0 \le a_i \le 1) — the elements of the array .
Print a single integer — the minimum number of adjacent swaps needed to sort the array.
Example 1
Example 2
Example 3
If your solution works correctly for n \le 1\,000, it will earn at least points.