N = int(input()) S = input() Sl = S.split('T') ans = 0 for i in range(1, len(Sl)): if len(Sl[i-1]) >= 3 and Sl[i-1][-3:] == "CPC": if len(Sl[i]) >= 1 and Sl[i][0] == "F": ans += 1 elif len(Sl[i]) >= 3 and Sl[i][:3] == "CPC": ans += 1 Sl[i] = Sl[i][3:] print(ans)