def main(): N = int(input()) S = list(input()) for i in range(N): if i + 7 <= N and S[i:i+7] == ['C', 'P', 'C', 'T', 'C', 'P', 'C']: S[i + 4: i + 7] = ['F', ' ', ' '] ans = 0 for i in range(N): if i + 5 <= N and S[i: i + 5] == ['C', 'P', 'C', 'T', 'F']: ans += 1 print(ans) return 0 main()