#include int main() { unsigned long long n; int r; scanf("%llu", &n); r = 0; while(1){ int b = n % 10; if(b == 3){ r++; n /= 10; } else if(n == 1){ if(r == 0){ r = -1; } break; } else { r = -1; break; } } printf("%d\n", r); }