Question
Minimum Adjacent Swaps to Sort a Binary Array
You are given a binary array. Adjacent elements may be swapped. Find the minimum number of adjacent swaps needed to make all
Input
The first line contains KaTeX can only parse string typed expression. The second line contains KaTeX can only parse string typed expression values, each either KaTeX can only parse string typed expression or KaTeX can only parse string typed expression.
Output
Print the minimum number of adjacent swaps.
Example
Example:
Input
Input
5
1 0 1 0 1Output3