#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  int i = 0;
asdf:
  for (; i < (s.length() - 1); i++) {
    if (s[i] != s[i + 1]) {
      s.erase(i, 2);
      if (s.length() == 0) break;
      if (i > 0) i--;
      goto asdf;
    }
  }
  cout << s.length();
}
