N = int(input()) S = input() X = [[0] * 3 for _ in range(3)] for i, c in enumerate(list(S)): if c == "c": X[i % 3][0] += 1 if c == "o": X[(i - 1) % 3][1] += 1 if c == "n": X[(i - 2) % 3][2] += 1 ans = 0 usable = 3 * N for i in range(3): tmp = min(min(X[i]), usable // 3) ans += tmp usable -= min(3 * tmp + 1, 0) print(ans)