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