For this Question: Given an array of N integers containing only 0 or 1. You can do the following operations on the array:
<ul><li>swap elements at two indices</li><li>choose one index and change its value from 0 to 1 or vice-versa.</li></ul>
You have to do the minimum number of the above operations such that the final array is non-decreasing.
<b>Note</b> Consider 1 based Array-indexingThe first line of input contains a single integer N.
The second line of input contains N space-separated integers denoting the array.

Constraints: 
1 &le; N &le; 100000
elements of the array are 0 or 1.Minimum number of moves required such that the final array is non- decreasing.Sample Input 1
5
1 1 0 0 1 

Sample Output 1
2

Explanation: 
Swap indices (1, 3)
Swap indices (2, 4)

Sample Input 2
5
0 0 1 1 1 

Sample Output 2
0, I have written this Solution Code: import java.io.*;
import java.util.*;



class Main {
	public static void main (String[] args) throws IOException {
        BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
        int n = Integer.parseInt(br.readLine().trim());
        String array[] = br.readLine().trim().split(" ");

        boolean decreasingOrder = false;

        int[] arr = new int[n];
        int totalZeroCount = 0,
            totalOneCount = 0;
        for(int i = 0; i < n; i++) {
            arr[i] = Integer.parseInt(array[i]);
            if(i != 0 && arr[i] < arr[i - 1])
                decreasingOrder = true;
            if(arr[i] % 2 == 0)
                ++totalZeroCount;
            else
                ++totalOneCount;
        }

        if(!decreasingOrder) {
            System.out.println("0");
        } else {
            int oneCount = 0;

            for(int i = 0; i < totalZeroCount; i++) {
                if(arr[i] == 1)
                    ++oneCount;
            }
            System.out.println(oneCount);
        }
	}
}, In this Programming Language: Java, Now tell me if this Code is compilable or not?