#include #include #include int main() { std::string in; std::cin >> in; if(*in.begin() != '1') { std::cout << -1 << std::endl; } else { int counter = 0; for(auto itr = in.begin() + 1; itr != in.end(); ++itr) { if(*itr != '3') { std::cout << -1 << std::endl; return 0; } counter++; } std::cout << (counter == 0 ? -1 : counter) << std::endl; } return 0; }