#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, temp;
  cin >> n;
  string s;
  cin >> s;
  temp = n;
  for (int i = n - 2; i >= 0; i--) {
    if (s.substr(i, 2) == "10" || s.substr(i, 2) == "01") {
      temp -= 2;
      s.erase(i, 2);
      i++;
    }
  }
  cout << temp;
  return 0;
}
