fn main() { let mut n = String::new(); std::io::stdin().read_line(&mut n).ok(); let n: usize = n.trim().parse().unwrap(); let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); let s = s.trim().chars().collect::>(); let mut cnts = vec![vec![0usize; 3]; 3]; for i in 0..s.len() { if s[i] == 'c' { cnts[0][i%3] += 1; } else if s[i] == 'o' { cnts[1][i%3] += 1; } else if s[i] == 'n' { cnts[2][i%3] += 1; } } let result = (0..3).map(|i| cnts[0][i].min(cnts[1][(i+1)%3]).min(cnts[2][(i+2)%3])).sum::(); let result = if result == n && (0..3).map(|i| cnts[i][i] == n).fold(true, |x, y| x && y) { n } else if result == n { n - 1 } else { result }; println!("{}", result); }