#include <bits/stdc++.h>
using namespace std;
int main() {
  ios ::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  int c = 0;
  string s;
  cin >> s;
  for (int i = s.length() - 1; i > 0; i--) {
    if (s[i] == '0')
      c++;
    else if (s[i] == '1')
      c += 2, s[i - 1]++;
    else
      c++, s[i - 1]++;
  }
  if (s[0] == '2') c++;
  cout << c;
  return 0;
}
