#include <iostream>
#include <vector>
#include <algorithm>
#include <map>
using namespace std;
void solve() {
string s;
cin >> s;
int o = 0;
for (int i = 0; i < s.size(); i++) {
if (s[i] == '1') {
o++;
}
}
for (int i = 0; i < s.size() - 2; i++) {
if (s[i] == s[i + 2] && s[i] == '1') {
o++;
}
}
cout << o;
}
int main() {
int t = 1;
//cin >> t;
while(t--){
solve();
}
}