N=int(input()) S=input().strip() ANS=0 ind=len(S)-1 while ind>=0: if ind-4>=0 and S[ind-4:ind+1]=="CPCTF": ANS+=1 ind-=5 elif ind-6>=0 and S[ind-6:ind+1]=="CPCTCPC": ANS+=1 ind-=7 else: ind-=1 print(ANS)