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..3*n { match s[i] { 'c' => { cnts[0][i%3] += 1; }, 'o' => { cnts[1][i%3] += 1; }, 'n' => { cnts[2][i%3] += 1; }, _ => {}, } } let result = (0..3).map(|i| cnts[0][i%3].min(cnts[1][(i+1)%3]).min(cnts[2][(i+2)%3])).sum::(); let result = if result == n && cnts[0][0] < n { result-1 } else { result }; println!("{}", result); }