N = int(input()) S = input() a0 = sum([c != d for (c, d) in zip(S[-5:], "HAPPY")]) a1 = S[:-4].count("HAPPY") print(a0 + a1)