#include <bits/stdc++.h>
using namespace std;
struct UnionFind {
 private:
  const int n;
  int __size;
  vector<int> uf;

 public:
  UnionFind(int _n) : n(_n), __size(_n), uf(_n, -1) {}
  int find(int x) { return (uf[x] < 0) ? x : uf[x] = find(uf[x]); }
  bool same(int x, int y) { return find(x) == find(y); }
  int size(int x) { return -uf[find(x)]; }
  int size() { return __size; }
  void unite(int x, int y) {
    x = find(x);
    y = find(y);
    if (x == y) return;
    __size--;
    if (uf[y] < uf[x]) swap(x, y);
    uf[x] += uf[y];
    uf[y] = x;
  }
};
int a[200010];
int main() {
  cin.tie(0);
  string S;
  cin >> S;
  int ans = 0;
  int stack = 100005;
  a[stack] = 1;
  for (int i = 0; i < S.length(); i++) {
    if (S[i] == '0')
      stack--;
    else
      stack++;
    if (a[stack]) {
      ans++;
      a[stack] = 0;
    } else {
      a[stack] = 1;
    }
  }
  cout << ans * 2 << endl;
}
