#include <bits/stdc++.h>
using namespace std;
int n;
int main() {
  cin >> n;
  bool wasOne;
  string reconstruction;
  string s;
  cin >> s;
  for (int i = 0; i < n; i++) {
    if (reconstruction.size() >= 1) {
      reconstruction.push_back(s[i]);
      if ((reconstruction.substr(reconstruction.length() - 2) == "10") ||
          (reconstruction.substr(reconstruction.length() - 2) == "01")) {
        reconstruction.pop_back();
        reconstruction.pop_back();
      }
    } else {
      reconstruction.push_back(s[i]);
    }
  }
  cout << reconstruction.size() << endl;
}
