from collections import defaultdict def solve(): N=int(input()) S=input() A=[defaultdict(int), defaultdict(int), defaultdict(int)] for i in range(3*N): if S[i]=="c" or S[i]=="o" or S[i]=="n": A[i%3][S[i]]+=1 else: A[i%3]["x"]+=1 c,o,n,x="conx" ans=0 p,q,r=c,o,n for t in range(3): x=min(A[0][p],A[1][q],A[2][r]) if t!=0: x=min(x,N-1) ans+=x p,q,r=q,r,p return ans print(solve())