from collections import * N = int(input()) S = list(input()) D = [defaultdict(int) for i in range(3)] for i in range(3*N): D[i%3][S[i]] += 1 L = [0, 0, 0] L[0] = min(D[0]["c"], D[1]["o"], D[2]["n"]) L[1] = min(D[0]["n"], D[1]["c"], D[2]["o"]) L[2] = min(D[0]["o"], D[1]["n"], D[2]["c"]) # print(L) # print(D) ans = 0 N *= 3 if N >= 3 * L[0]: ans += L[0] if L[0]: N -= 3 * L[0] + 1 N = max(0, N) else: print(ans + N//3) exit() if N >= 3 * L[1]: ans += L[1] if L[1]: N -= 3 * L[1] + 1 N = max(0, N) else: print(ans + N//3) exit() if N >= 3 * L[2]: ans += L[2] if L[2]: N -= 3 * L[2] + 1 N = max(0, N) else: print(ans + N//3) exit() print(ans)