#include <bits/stdc++.h>
using namespace std;
int main() {
  int length;
  cin >> length;
  string str;
  cin >> str;
  stack<char> s;
  bool need_analysis = true;
  s.push(str[0]);
  for (int i = 1; i < str.length(); ++i) {
    if (s.empty()) {
      s.push(str[i]);
    } else {
      if (s.top() != str[i]) {
        length -= 2;
        s.pop();
      } else {
        s.push(str[i]);
      }
    }
  }
  cout << length << endl;
}
