#include using namespace std; int main(void) { int n; cin >> n; stack st; for (int i = 0; i < n; i++) { int x; cin >> x; x += (int)1e9; if (!st.empty() && x % 2 == 0 && st.top() % 2 == 1) { st.pop(); } else if (!st.empty() && x % 2 == 1 && st.top() % 2 == 0) { st.pop(); } else { st.push(x); } } cout << st.size() << endl; return 0; }