n = int(input()) s = input() s = s.replace("CPCT", "A") print(s.count("AF")+s.count("ATCPC"))