#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s >> s;
  for (long y = 0; y < s.length(); y++) {
    if ((s[y + 1] == '1' && s[y] == '0') || (s[y + 1] == '0' && s[y] == '1')) {
      s.erase(y, 2);
      if (y >= 2)
        y -= 2;
      else
        y = -1;
    }
  }
  cout << s.length();
}
