N = int(input()) S = input() ans = S[:-5].count("HAPPY") for i in range(-5,0): ans += "HAPPY"[i] != S[i] print(ans)