/* No.791 うし数列 https://yukicoder.me/problems/no/791 */ #include using namespace std; int main() { ios::sync_with_stdio(0); cin.tie(0); string n; cin >> n; if (n[0] != '1') { cout << -1 << endl; return 0; } for (size_t i = 1; i < n.size(); i++) { if (n[i] != '3') { cout << -1 << endl; return 0; } } cout << (n.size() - 1) << endl; }