n = int(input()) s = input() # Collect positions of CPC in original CPCTF substrings original_cpc_positions = set() for i in range(n - 4): if s[i] == 'C' and s[i+1] == 'P' and s[i+2] == 'C' and s[i+3] == 'T' and s[i+4] == 'F': # Mark the CPC part (i, i+1, i+2) original_cpc_positions.add(i) original_cpc_positions.add(i+1) original_cpc_positions.add(i+2) count_original = len(original_cpc_positions) // 3 # Each CPCTF has one CPC count_operable = 0 for i in range(2, n - 1): # Check if the current CPC is CPC and followed by T if s[i-2] == 'C' and s[i-1] == 'P' and s[i] == 'C' and s[i+1] == 'T': # Check if any of the positions i-2, i-1, i are in original_cpc_positions if (i-2 not in original_cpc_positions) and (i-1 not in original_cpc_positions) and (i not in original_cpc_positions): count_operable += 1 print(count_original + count_operable)