N=int(input()) S=input() queue=[] for s in S: queue.append(s) if len(queue)>=7 and queue[-7:]==list("CPCTCPC"): for _ in range(7): queue.pop() queue+=list("CPCTF") ans=0 N=len(queue) for i in range(N-4): if queue[i:i+5]==list("CPCTF"): ans+=1 print(ans)