N = int(input()) S = input() A = "HAPPY" ans = 5 S[:-5].replace(A, ",") ans += S.count(",") for i in range(1, 6): if S[-1 * i] == A[i - 1]: ans -= 1