import sys #input = sys.stdin.readline #input = sys.stdin.buffer.readline #文字列はダメ #sys.setrecursionlimit(1000000) import math #import bisect #import itertools #import random #from heapq import heapify, heappop, heappush #from collections import defaultdict #from collections import deque #import copy #DeepCopy: hoge = [_[:] for _ in hogehoge] #from functools import lru_cache #@lru_cache(maxsize=None) #MOD = pow(10,9) + 7 #MOD = 998244353 #dx = [1,0,-1,0] #dy = [0,1,0,-1] #dx8 = [1,1,0,-1,-1,-1,0,1] #dy8 = [0,1,1,1,0,-1,-1,-1] def main(): n = int(input()) S = str(input()) C = [0,0,0]; O = [0,0,0]; N = [0,0,0] for i in range(3*n): if S[i] == 'c': C[i%3] += 1 if S[i] == 'o': O[i%3] += 1 if S[i] == 'n': N[i%3] += 1 first = min(C[0],O[1],N[2]) second = min(C[1],O[2],N[0]) third = min(C[2],O[0],N[1]) # print(C,O,N,first,second,third) block = first ans = first if second > 0: block += second + 1 if block > n: ans += second-1 print(ans);exit() else: ans += second if third > 0: if second > 0: block += third else: block += third + 1 if block > n: ans += third - 1 else: ans += third print(ans) if __name__ == '__main__': main()