D. Kozak Vus and the Array
Very easy
Execution time limit is 1 second
Runtime memory usage limit is 256 megabytes
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 () — the length of the array .
The second line contains integers () — the elements of the array .
Output
Print a single integer — the minimum number of adjacent swaps needed to sort the array.
Examples
Input #1
Answer #1
Input #2
Answer #2
Input #3
Answer #3
Scoring
If your solution works correctly for , it will earn at least points.
Submissions 1K
Acceptance rate 30%