fn main() { let mut buf = String::new(); std::io::stdin().read_line(&mut buf).unwrap(); buf = buf.trim().to_string(); if buf.chars().nth(0).unwrap() != '1' || buf.len() == 1 { println!("-1"); return; } let mut n = 0; for c in buf.chars().skip(1) { if c != '3' { println!("-1"); return; } n += 1; } println!("{}", n); }