#include <iostream>
using namespace std;
int count(string s,int m,int n)
{
    int res=0;
    for(int i=0;i<s.length();)
    {
        int carry=0,t;
        for(int j=i;j<s.length();j++)
        {
            t=carry;
            carry=(carry*m+s[j]-'0')%n;
            s[j]=(t*m+s[j]-'0')/n+'0';
        }
        if(carry==1) res++;
        while(s[i]=='0') i++;
    }
    return res;
}
int main() {
    string s;//适用于大数,不仅限于int
    while(cin>>s)
    {
        cout<<count(s,10,2)<<endl;
    }
}
// 64 位输出请用 printf("%lld")