#include <bits/stdc++.h>
using namespace std;
vector<string> vp;
vector<int> vp1;
vector<int> vp2;
vector<int> vp3;
set<int> s;
long long cnt = 0, cnt1 = 0;
int main() {
  long long n;
  cin >> n;
  string a;
  cin >> a;
  for (long long i = 0; i < n; i++) {
    if (a[i] == '0') {
      cnt++;
    } else if (a[i] == '1') {
      cnt1++;
    }
  }
  if (cnt == cnt1) {
    cout << 0 << endl;
    return 0;
  }
  if (cnt > cnt1) {
    cout << n - (cnt1 * 2) << endl;
    return 0;
  }
  if (cnt < cnt1) {
    cout << n - (cnt * 2) << endl;
    return 0;
  }
  return 0;
}
