package main import ( "bufio" "fmt" "os" "strconv" ) var sc = bufio.NewScanner(os.Stdin) func main() { sc.Buffer(make([]byte, 1000), 500000) sc.Split(bufio.ScanWords) n := nextInt() s := nextString() a := make([][]int, 3) for i := range a { a[i] = make([]int, 3) } for i := range s { if s[i] == 'c' { a[0][i%3]++ } if s[i] == 'o' { a[1][i%3]++ } if s[i] == 'n' { a[2][i%3]++ } } ans := 0 // tmp := a[0][0] // if a[1][1] < tmp { // tmp = a[1][1] // } // if a[2][2] < tmp { // tmp = a[2][2] // } // ans += tmp for i := range a { tmp := a[0][i] if a[1][(i+1)%3] < tmp { tmp = a[1][(i+1)%3] } if a[2][(i+2)%3] < tmp { tmp = a[2][(i+2)%3] } ans += tmp if i == 0 && ans == n { fmt.Println(ans) return } } if ans == n { ans-- } fmt.Println(ans) } func nextInt() int { sc.Scan() i, e := strconv.Atoi(sc.Text()) if e != nil { panic(e) } return i } func nextString() string { sc.Scan() return sc.Text() }