#include <iostream>
#include <algorithm>
#include <vector>
#include <map>
#include <cmath>
#include <deque>
#include <set>
using namespace std;
int main()
{
//speedup;
string s;
int ans=0;
cin>>s;
int n=s.size();
for(int i=0;i<n;i++)
{
if(s[i]=='1')
{
ans++;
}
else
{
if(0<i&&i<n-1)
{
if(s[i-1]=='1'&&s[i+1]=='1')
{
ans++;
}
}
}
}
cout<<ans<<endl;
return 0;
}