import sys input = lambda :sys.stdin.readline()[:-1] ni = lambda :int(input()) na = lambda :list(map(int,input().split())) yes = lambda :print("yes");Yes = lambda :print("Yes");YES = lambda : print("YES") no = lambda :print("no");No = lambda :print("No");NO = lambda : print("NO") ####################################################################### n = ni() s = input() s = list(s) #print(s) ans = 0 i = 0 while i < n-4: if s[i: i+5] == list("CPCTF"): ans += 1 i += 5 elif s[i: i+7] == list("CPCTCPC"): i += 7 ans += 1 print(ans)