n = int(input()) s = input().strip() # Split into three groups based on position mod 3 (1-based) group1 = [] group2 = [] group3 = [] for i in range(len(s)): pos = i + 1 # Convert to 1-based index if pos % 3 == 1: group1.append(s[i]) elif pos % 3 == 2: group2.append(s[i]) else: group3.append(s[i]) # Count 'c', 'o', 'n' in each group def count_chars(group): c = group.count('c') o = group.count('o') n = group.count('n') return c, o, n c1, o1, n1 = count_chars(group1) c2, o2, n2 = count_chars(group2) c3, o3, n3 = count_chars(group3) # Calculate the maximum possible 'con' for each triplet type type1 = min(c1, o2, n3) type2 = min(c2, o3, n1) type3 = min(c3, o1, n2) total = type1 + type2 + type3 print(total)