N = int(input()) NN *= 3 S = input() dat = [[0] * 3 for _ in range(3)] for i in range(NN): j = i % 3 if S[i] == "c": dat[j][0] += 1 elif S[i] == "o": dat[j][1] += 1 elif S[i] == "n": dat[j][2] += 1 ans = 0 """ for i in range(3): ans += min(dat[i][0],dat[(i+1)%3][1],dat[(i+2)%3][2]) """ ans += min(dat[0][0],dat[1][1],dat[2][2]) t = min(dat[1][0],dat[2][1],dat[0][2]) if t == N: t -= 1 ans += t t = min(dat[2][0],dat[0][1],dat[1][2]) if t == N: t -= 1 ans += t print(ans)