N = int(input()) S = input() T = ["CPCTF", "CPCTCPC"] ret = 0 i = 0 while i < N: found = False for s in T: if i + len(s) <= N and S[i:i+len(s)] == s: ret += 1 i += len(s) found = True break i += not found print(ret)