n = int(input()) s = input().strip() count_cpctf = 0 for i in range(n - 4): if s[i] == 'C' and s[i+1] == 'P' and s[i+2] == 'C' and s[i+3] == 'T' and s[i+4] == 'F': count_cpctf += 1 count_cpctcpc = 0 for i in range(n - 6): if (s[i] == 'C' and s[i+1] == 'P' and s[i+2] == 'C' and s[i+3] == 'T' and s[i+4] == 'C' and s[i+5] == 'P' and s[i+6] == 'C'): count_cpctcpc += 1 print(count_cpctf + count_cpctcpc)