For this Question: Given an array of N elements where each element is either 1 or 0. You have to divide the array into maximum number of subarrays such that each element of the array is in exactly one subarray such that each subarray has equal number of 1's and 0's.First line of input contains N.
Second line of input contains N space separated elements of the array.

Constraints:
1 <= N <= 100000
0 <= elements of the array <= 1Print the single integer which is the maximum number of subarrays the array can be divided into. If it is not possible then print -1.Sample input 1
4
1 0 1 0

Sample output 1
2

Sample input 2
4
1 1 0 0

Sample output 2
1, I have written this Solution Code: n = int(input())
a = input().split()
o,z = 0,0
cnt = 0
for i in a:
    if i == '1':
        o += 1
    else:
        z +=1
    if o == z:
        cnt += 1
if o == z:
    print(cnt)
else:
    print(-1), In this Programming Language: Python, Now tell me if this Code is compilable or not?