#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
inline int nextInt() {
  int s = 1, x = 0, c = getc(stdin);
  while (c <= 32) c = getc(stdin);
  if (c == '-') s = -1, c = getc(stdin);
  while ('0' <= c && c <= '9') x = x * 10 + c - '0', c = getc(stdin);
  return x * s;
}
inline void printInt(int x) {
  if (x < 0) putc('-', stdout), x = -x;
  char s[20];
  int n = 0;
  while (x || !n) s[n++] = '0' + x % 10, x /= 10;
  while (n--) putc(s[n], stdout);
}
inline void NextString(char *s) {
  int c = getc(stdin);
  while (c <= 32) c = getc(stdin);
  while (c > 32) *s++ = c, c = getc(stdin);
  *s = 0;
}
inline void writeWord(char *s) {
  while (*s) putchar(*s++);
}
void solve() {}
int main() {
  int n = nextInt();
  string s = "";
  for (int i = 0; i < n; ++i) {
    char c = getchar();
    s += c;
    if (s.size() > 1) {
      string t = s.substr(s.size() - 2, s.size());
      if (t == "01" || t == "10") {
        s.pop_back();
        s.pop_back();
      }
    }
  }
  cout << s.size();
}
