n = int(input()) s = input() pos = [[0]*3 for i in range(3)] for i,c in enumerate(s): if c == "c": pos[0][i%3] += 1 elif c == "o": pos[1][i%3] += 1 elif c == "n": pos[2][i%3] += 1 now = 0 ans = 0 for i in range(3): while now % 3 != i: now += 1 cc,oo,nn = pos[0][(0+i)%3], pos[1][(1+i)%3], pos[2][(2+i)%3] mn = min(cc,oo,nn) now += mn * 3 ans += mn if mn == 0: continue while now > 3*n: ans -= 1 now -= 3 print(ans)