#include typedef long long ll; typedef std::pair P; typedef std::priority_queue, std::greater

> PQ; int main() { std::string s; std::cin >> s; int n = s.length(); ll ans = 0; int count = 0; for (int i = 0; i < n; ++i) { if (s[i] == '1') count++; else { if (s[i] == '0') { ans += count / 2; count -= count % 2; } } } std::cout << ans << std::endl; }