#include #include int main() { //std::ifstream inf("Text.txt"); std::cin.rdbuf(inf.rdbuf()); int N; std::cin >> N; int ans = 0; while (1) { if (N == 1) { break; } if (N % 10 == 3) { ans++; N = N / 10; } else{ ans = -1; break; } } std::cout << ans << std::endl; return 0; }