#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  char s[n + 1];
  cin >> s;
  char prev = s[0];
  int j = 1;
  for (int i = 1; i < n; i++) {
    if (j == 0) {
      prev = s[i];
      j++;
      continue;
    }
    if (s[i] != prev) {
      j--;
    } else {
      j++;
    }
  }
  cout << j;
}
