#include "bits/stdc++.h" using namespace std; typedef pair P; #define int long long #define ll long long #define mod 1000000007 #define INF (1LL<<60) #define rep(i,n) for(int i=0, i##_len=(n); i> s; if (s[0] != '1'){ cout << -1 << endl; return 0; } if (s.length() == 1){ cout << -1 << endl; return 0; } for (int i = 1; i < s.length(); i++){ if (s[i] != '3'){ cout << -1 << endl; return 0; } } cout << s.length()-1 << endl; return 0; }