#include <bits/stdc++.h>
using namespace std;
char s[1000010];
int main() {
  while (scanf("%s", s) != EOF) {
    int len = strlen(s);
    len--;
    int n = 100000000, m, ii, i = 0, nn;
    while (len >= 0) {
      if (s[len] == '1')
        m = 1;
      else
        m = 0;
      ii = min(m + i, m + n);
      nn = min(2 - m + 1 + i, 2 - m - 1 + n);
      i = ii;
      n = nn;
      len--;
    }
    printf("%d\n", min(i, n));
  }
  return 0;
}
