N=int(input()) S=input() T="" i=0 tmp="" while i=4 and T[-4:]=="CPCT": for _ in range(2): i+=1 if i==N:break tmp+=S[i] if tmp=="CPC":T+="F" else:T+=tmp tmp="" else: T+=tmp tmp="" i+=1 print(T.count("CPCTF"))