N=int(input()) S=input() D={} D['c']=[0,0,0] D['o']=[0,0,0] D['n']=[0,0,0] for i in range(3*N): s=S[i] if s not in D: D[s]=[0]*3 D[s][i%3]+=1 a=min(D['c'][0],D['o'][1],D['n'][2]) b=min(D['c'][1],D['o'][2],D['n'][0]) c=min(D['c'][2],D['o'][0],D['n'][1]) d=a+b+c if N!=d: print(d) else: if S=='con'*N: print(d) else: print(d-1)