#include using namespace std; #ifdef local #include #else #define debug(...) #endif #define rep(i, n) for (int i = 0; i < n; i++) template istream& operator>>(istream& I, vector& V) {for (T& X : V) I >> X; return I;} template inline bool chmax(T& a, T b) {if (a < b) {a = b; return true;} return false;} template inline bool chmin(T& a, T b) {if (a > b) {a = b; return true;} return false;} vector di = {-1, 1, 0, 0}, dj = {0, 0, -1, 1}; int inf = 2e9; long INF = 1e18; int main() { string s; cin >> s; int n = s.size(); int x = 0; long ans = 0; for (int i = n - 1; i > 0; i--) { debug(i); if (s[i] == '1') { if (s[i - 1] == '1') { ans += x; i--; } } else { x++; } } /* 11010110 11010011 01110011 01011011 01001111 */ cout << ans << endl; return 0; }