#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, i, z = 0, q = 0, o = 0;
  char ar[1000005];
  cin >> ar;
  t = strlen(ar);
  for (i = 0; i < t; i++) {
    if (ar[i] == '1') o++;
    if (ar[i] == '0')
      z++;
    else
      q++;
  }
  t = abs(o - z);
  if (q % 2 == 0) t = abs(t - 1);
  cout << t << endl;
}
