#include using namespace std; using ll = long long; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, ans = 0; string s, t = "HAPPY"; cin >> n >> s; while(!t.empty()){ ans += s.back() != t.back(); s.pop_back(); t.pop_back(); } for(int i = 0; i + 5 <= (int)s.size(); i++){ ans += s.substr(i, 5) == "HAPPY"; } cout << ans << '\n'; }