package main import "fmt" func main() { var n string fmt.Scan(&n) ok := true cnt := 0 if n[0] != '1' || len(n) == 1 { ok = false } else { for i := 1; i < len(n); i++ { // fmt.Printf("%s ", string(n[i])) if n[i] == '3' { cnt++ } else { ok = false break } } } if ok { fmt.Println(cnt) } else { fmt.Println(-1) } }