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