#include using namespace std; int a[128]; // 'a' から c までの文字で作れる s より大きい文字列の個数 int count(string s, char c) { int res = 0; if (s.empty()) { for (; c >= 'a'; c--) res += a[c]; return res; } for (; c > s[0]; c--) res += a[c]; int k = min(a[c], count(s.substr(1), c - 1)); res += k + (a[c] - k) / 2; return res; } int main() { int N; cin >> N; string S; cin >> S; for (int i = 0; i < N; i++) a[S[i]]++; cout << count("yuki", 'z') << endl; }