#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int count = 0;
  if (s[0] == '1') {
    string tmp;
    for (auto&& i : s) {
      if (i == '0') {
        tmp.push_back('1');
      } else {
        tmp.push_back('0');
      }
    }
    s = tmp;
  }
  int work = 0;
  for (size_t i = 0; i < s.size(); i++) {
    if (s[i] == '0') {
      work += 1;
    } else if (s[i] == '1') {
      work -= 1;
      count += 1;
    }
    work = max(0, work);
  }
  cout << count * 2 << endl;
}
