#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int z = 0, q = 0, o = 0;
  for (int i = 0; i < s.size(); i++) {
    if (s[i] == '?')
      q++;
    else if (s[i] == '1')
      o++;
    else
      z++;
  }
  cout << abs(z - o) << "\n";
}
