#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  ;
  int n;
  cin >> n;
  string str;
  cin >> str;
  long long one = 0, zero = 0;
  for (long long i = 0; i < str.size(); i++) {
    if (str[i] == '0')
      zero++;
    else
      one++;
  }
  if (one == 0 || zero == 0)
    cout << str.size() << endl;
  else
    cout << str.size() - (min(one, zero) * 2) << endl;
  return 0;
}
