#include <bits/stdc++.h>
using namespace std;
const long long int maxN = 1E5 + 10;
const long long int mod = 1E9 + 7;
const long long int INF = 1E9;
int32_t main() {
  string s;
  cin >> s;
  long long int n = s.size();
  if (s == "1") {
    cout << 0 << "\n";
    return 0;
  }
  reverse(s.begin(), s.end());
  long long int otp = n - 1;
  for (long long int i = 0; i < n - 1; ++i) {
    if (s[i] == '1') {
      ++otp;
      if (i < n - 1) ++s[i + 1];
    }
    if (s[i] == '2' && i < n - 1) ++s[i + 1];
  }
  if (s[n - 1] == '2') ++otp;
  cout << otp << "\n";
  return 0;
}
