import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner scan = new Scanner(System.in); int N = scan.nextInt(); int cnt1 = 0; int cnt2 = 0; for(int i = 0; i < N; i++) { long x = scan.nextLong(); if(x % 2 == 0) { cnt1 ++; }else { cnt2 ++; } } scan.close(); int ans = 0; if(cnt1 >= cnt2) { ans = cnt1 - cnt2; }else { ans = cnt2 - cnt1; } System.out.println(ans); } }