#include <bits/stdc++.h>
using namespace std;
int main() {
  long long i, ret = 0;
  bool carr = 0;
  string num;
  cin >> num;
  while (num != "1") {
    ret++;
    if (num[(num).size() - 1] == '0')
      num.erase((num).size() - 1);
    else {
      carr = 1;
      for ((i) = ((num).size() - 1); (i) >= 0; (i)--)
        if (num[i] == '1')
          num[i] = '0';
        else {
          num[i] = '1';
          carr = 0;
          break;
        }
      if (carr) {
        num += "0";
        num[0] = '1';
      }
    }
  }
  cout << ret << endl;
  return 0;
}
