#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  cin >> s;
  int N = s.size();
  int total = 0;
  s = "0" + s + "0";
  bool chain = false;
  int zd = 0;
  for (int i = 1, j = 0; j < N; i++, j++) {
    if (s[i] == '1') {
      zd = 0;
      if (s[i - 1] == '0' && s[i + 1] == '0')
        total += 1;
      else if (s[i - 1] == '0' && s[i + 1] == '1')
        total += (chain ? 0 : 1);
      else {
        chain = true;
        if (s[i - 1] == '1' && s[i + 1] == '0')
          total += 1;
        else if (s[i - 1] == '1' && s[i + 1] == '1')
          total += 0;
      }
    } else
      zd += 1;
    if (zd > 1) chain = false;
  }
  cout << total << endl;
  return 0;
}
