n = int(input()) s = input().strip() # Initialize counts for 'c', 'o', 'n' in each of the three groups (0, 1, 2) c = [0, 0, 0] o = [0, 0, 0] n_ = [0, 0, 0] for i in range(len(s)): group = i % 3 char = s[i] if char == 'c': c[group] += 1 elif char == 'o': o[group] += 1 elif char == 'n': n_[group] += 1 # Calculate the maximum possible 'con' substrings max_con = min(c[0], o[1], n_[2]) + min(c[1], o[2], n_[0]) + min(c[2], o[0], n_[1]) print(max_con)