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