#include <bits/stdc++.h>
using namespace std;
int main() {
  int aa;
  cin >> aa;
  vector<int> fu;
  string f;
  cin >> f;
  for (int i = 0; i < aa; i++) {
    int a = f[i] - '0';
    if (fu.size() != 0 && fu.back() == abs(a - 1)) {
      fu.pop_back();
    } else {
      fu.push_back(a);
    }
  }
  cout << fu.size();
}
