input: Write a Python function to determine if the number of inversions of two different types is identical.
  assert solve([1,0,2],3) == True
  assert solve([1,2,0],3) == False
  assert solve([1,2,1],3) == True
output: def solve(arr, n):
      inv_01 = sum(1 for i in range(n) for j in range(i+1, n) if arr[i] == 0 and arr[j] == 1)
      inv_10 = sum(1 for i in range(n) for j in range(i+1, n) if arr[i] == 1 and arr[j] == 0)
      return inv_01 == inv_10