// Arup Guha
// 1/19/2018
// Solution to 2013 NAQ Problem: Even Up

import java.util.*;

public class evenup {

	public static void main(String[] args) {

		Scanner stdin = new Scanner(System.in);
		int n = stdin.nextInt();
		Stack<Integer> s = new Stack<Integer>();

		// Process each number.
		for (int loop=0; loop<n; loop++) {
			int val = stdin.nextInt()%2;

			// If we have no numbers, or this one doesn't match the last, push it.
			if (s.size() == 0 || s.peek()%2 != val%2)
				s.push(val);

			// Greedily pair up this number with the last one.
			else
				s.pop();
		}

		// Ta da!
		System.out.println(s.size());
	}
}