import java.io.*; import java.util.*; class Main99 { public static void out (Object o) { System.out.println(o); } public static void main (String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int cnt1 = 0 , cnt2 = 0; int n = Integer.parseInt(br.readLine()); String[] line = br.readLine().split(" "); for (int i = 0; i < n; i++) { int m = Integer.parseInt(line[i]); if (m % 2 == 0) cnt1++; else cnt2++; } out(Math.abs(cnt1 - cnt2)); } }