import java.util.*; import java.math.*; import java.io.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int N = sc.nextInt(); int a = 0; int b = 0; ArrayList list = new ArrayList(); for(int i = 0; i < N; i++) { if(sc.nextInt() % 2 == 0) a++; else b++; } if(a == 0 || b == 0) System.out.println(0); else { System.out.println(Math.abs(a- b)); } } }