#include using namespace std; int main() { int N; cin >> N; int c = 0; while (N > 0) { if (N % 10 == 3) { c++; N /= 10; if (N == 1) break; } else { c = -1; break; } } cout << c << endl; }