#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; using ll = long long; using pall = pair; using vell = vector; template constexpr bool mini(T &var, const U &val) noexcept { const bool cmp = var > val; if(cmp) var = val; return cmp; } template constexpr bool maxi(T &var, const U &val) noexcept { const bool cmp = var < val; if(cmp) var = val; return cmp; } void solve(); int main(void) { cin.tie(nullptr); ios::sync_with_stdio(false); solve(); return 0; } void solve() { string s; cin >> s; ll leftz = 0; ll ans = 0; for(const auto &e:s) { if(e == '1') leftz++; else { ans += leftz / 2; leftz -= leftz % 2; } } cout << ans; }