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']) if a > 0 and b > 0 and c > 0: ans = min(a+b+c,N-2) elif a > 0 and b > 0: ans = min(a+b,N-1) elif a > 0 and c > 0: ans = min(a+c,N-1) elif b > 0 and c > 0: ans =min(b+c,N-2) elif a: ans = a elif b: ans = min(b,N-1) elif c: ans= min(c,N-1) else: ans = 0 print(ans)