import collections N = int(input()) S = list(input()) C = [collections.Counter() for _ in range(3)] for i,c in enumerate(S): C[i%3][c]+=1 print(min(C[0]['c'],C[1]['o'],C[2]['n'])+min(N-1,min(C[0]['o'],C[1]['n'],C[2]['c']))+min(N-1,min(C[0]['n'],C[1]['c'],C[2]['o'])))