package main import "fmt" func main() { var line string fmt.Scan(&line) first := true count := 0 for _, l := range line { s := string(l) if first { if s != "1" { fmt.Println(-1) return } first = false continue } else { if s != "3" { fmt.Println(-1) return } else { count++ } } } if count == 0 { fmt.Println(-1) } else { fmt.Println(count) } }