#include using namespace std; int main(){ int c; c = getchar(); if(c != '1')return 0 & puts("-1"); long i = 1; c = getchar(); while(c == '3'){ ++i; c = getchar(); if('0' <= c && c <= '9' && c != '3')return 0 & puts("-1"); } cout << i << endl; return 0; }