import re n = int(input()) s = input() # p1 = [m.span() for m in re.finditer('CPC', s)] p2 = [m.span() for m in re.finditer('CPCTF', s)] p3 = [m.span() for m in re.finditer('CPCTCPC', s)] print(len(p2) + len(p3))