N = int(input()) S = input() i, current, cnt = 0, 0, 0 while i <= N: s = S[current:i] if (s == 'CPCTF'): cnt += 1 i += 1 current += 5 elif (s == 'CPCTCPC'): cnt += 1 i += 1 current += 6 else: i += 1 print(cnt)