#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  string s;
  cin >> s;
  stack<char> x;
  for (int i = 0; i < n; i++) {
    if (x.empty())
      x.push(s[i]);
    else if (x.top() != s[i])
      x.pop();
    else
      x.push(s[i]);
  }
  cout << x.size();
  return 0;
}
