#include <iostream>
#include <string>
#include <sstream>
#include <vector>
#include <algorithm>
#include <bits/stdc++.h>
#include <numeric>
#include <stack>
#include <map>
#include <iterator>
#include <iomanip>
#include <cstdlib>
#include <ctime>
#include <cctype>
#include <cmath>
#include <bitset>
using namespace std;
typedef long long ll;
#define pb push_back
typedef double db;
#define vel vector<long long>
#define ves vector<string>
typedef unsigned long long ull;
const double pi= std::acos(-1.0);
const ll lens=1e4+5;
const ll MAXN5=1e5+5;
//typedef pair<ll,ll> PLL;
ll xi[lens];
const ll M = 1e9+7;
ll yi[lens];
//ll bo[lens];
ll l,r,y;
ll n,m,r1,r2,i,j,sum2,cn,d,x0,y0,k;
string na,te,ss,s;
ll qpow1(ll a,ll b){
ll res=1;
while(b){if(b&1) res=res*a; a=a*a,b>>=1;}
return res;
}
ll qpow2(ll a,ll b,ll mod){
ll res=1;
while(b){if(b&1) res=(res*a)%mod; a=(a*a)%mod,b>>=1;}
return res;
}
bool cmp(string a,string b){
return a+b>b+a;
}
ll hwen(string s){
string d=s;
reverse(d.begin(),d.end());
return d==s;
}
void print(__int128_t num) {
if (num == 0) {
cout << '0';
return;
}
if (num < 0) {
cout << '-';
num = -num;
}
char s[100];
int i = 0;
while (num > 0) {
s[i++] = num % 10 + '0';
num /= 10;
}
while (i > 0) {
cout << s[--i];
}
}
ll iszs(ll number) {
if (number <= 1) {
return 0;
}
if (number <= 3) {
return 1;
}
if (number % 2 == 0 || number % 3 == 0) {
return 0;
}
ll sqrtNumber = sqrt(number);
for (ll i = 5; i <= sqrtNumber; i += 6) {
if (number % i == 0 || number % (i + 2) == 0) {
return 0;
}
}
return 1;
}
ll inv[MAXN5], fac[MAXN5], finv[MAXN5];
void init() {
inv[1] = 1;
for (ll i = 2; i < MAXN5; ++i)
inv[i] = inv[M % i] * (M - M / i) % M;
fac[0] = finv[0] = 1;
for (ll i = 1; i < MAXN5; ++i) {
fac[i] = fac[i - 1] * i % M;
finv[i] = finv[i - 1] * inv[i] % M;
}
}
ll CC(ll m, ll n) {
if (m < 0 || m > n)
return 0;
return fac[n] * finv[n - m] % M * finv[m] % M;
}
void sol(){
cin>>s;
stack<char> st;
string gd="";
string ans="";
for (ll i = 0; i < s.size(); ++i){
if (gd.size()==0){
gd+=s[i];
}
else{
if (s[i]==gd[gd.size()-1]){
gd+=s[i];
}
else{
if (ans.size()==0){
if (gd[0]=='1'){
ans+='1';
}
}
else{
ans+=gd[0];
}
gd="";
gd+=s[i];
}
}
}
if (gd.size()!=0){
if (gd[0]=='1'){
if (ans[ans.size()-1]=='0'){
ans+='1';
}
}
}
ll rq=0;
for (ll i = 0; i < ans.size(); ++i){
if (ans[i]=='0'){
if (i==ans.size()-1){
continue;
}
else{
if (ans[i+1]=='1'&&ans[i-1]=='1'){
rq++;
}
}
}
}
cout<<rq<<"\n";
/*
for (ll i = 0; i < s.size(); ++i) {
if (st.empty()){
if (s[i]=='0'){
continue;
}
else{
st.push(s[i]);
}
}
else{
if (s[i]=='0'){
}
else{
st.push(s[i]);
}
}
}
*/
/*
for (i=0;i<n;i++){
}
*/
//cout<<"Yes\n";
//cout<<"No\n";
}
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
init();
ll t=1;
//cin>>t;
while (t--){
sol();
}
return 0;
}