from collections import defaultdict N = int(input()) S = list(input()) cnt = [defaultdict(int) for _ in range(3)] for i,s in enumerate(S): cnt[i%3][s] +=1 a = min(cnt[0]['c'],cnt[1]['o'],cnt[2]['n']) b = min(cnt[0]['o'],cnt[1]['n'],cnt[2]['c']) c = min(cnt[0]['n'],cnt[1]['c'],cnt[2]['o']) tmp = 0 if a >0: tmp +=1 if b > 0: tmp +=1 if c > 0: tmp =+1 if tmp==3: ans = min(a+b+c,N-2) elif tmp ==2: ans = min(a+b+c,N-1) elif tmp == 1: ans = min(a+b+c,N) else: ans = 0 print(ans)