#include <bits/stdc++.h>
using namespace std;
char s[1000010];
int one, zero, unknow;
int main() {
  cin >> s;
  for (int i = 0; s[i] != '\0'; i++) {
    if (s[i] == '0')
      zero++;
    else if (s[i] == '1')
      one++;
    else
      unknow++;
  }
  int m = abs(zero - one);
  cout << m << endl;
  return 0;
}
