Kozak Vus and the Array#10261

Kozak Vus and the Array

1 second
256 megabytes
Very easy

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?

Input

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 .

Output

Print a single integer — the minimum number of adjacent swaps needed to sort the array.

Examples

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading

Scoring

If your solution works correctly for n \le 1\,000, it will earn at least points.