/* ---------- STL Libraries ---------- */ // IO library #include #include #include #include #include // algorithm library #include #include #include #include #include // container library #include #include #include #include #include #include #include #include #include #include #include /* ---------- Namespace ---------- */ using namespace std; /* ---------- Type ---------- */ using ll = long long; #define int ll #define P pair /* ---------- Constants */ const double PI = 3.141592653589793238462643383279; const ll MOD = 1e9 + 7; const int INF = 1LL << 55; /* v-v-v-v-v-v-v-v-v Main Part v-v-v-v-v-v-v-v-v */ signed main() { string str; cin >> str; if (str.size() < 2) { cout << -1 << endl; } if (str[0] != '0' + 1) { cout << -1 << endl; return 0; } for (int i = 1; i < str.size(); i++) { if (str[i] != '0' + 3) { cout << -1 << endl; return 0; } } cout << str.size() - 1 << endl; return 0; }