#include #include #include #include using namespace std; #define REP(i,s,e) for (i = s; i <= e; i++) #define rep(i,n) REP (i,0,(int)(n)-1) #define RREP(i,s,e) for (i = s; i >= e; i--) #define rrep(i,n) RREP (i,(int)(n)-1,0) #define INF (int)1e8 #define MOD (int)(1e9+7) typedef long long ll; int main(void) { int n; string s; cin >> n >> s; int ans = 0; int cnt[256] {}, sum[256]; for (auto c : s) cnt[c]++; ans += cnt['z']; n -= cnt['z']; cnt['z'] = 0; sum['z'] = 0; for (char c = 'y'; c >= 'a'; c--) sum[c] = sum[c+1] + cnt[c]; int x = min({sum['y'],sum['u']/2,sum['k']/3,sum['j']/4}); ans += x; cnt['y'] -= x; int tmp = x; for (char c = 'j'; tmp > 0 && c <= 'y'; c++) { int y = min(cnt[c],tmp); tmp -= y; cnt[c] -= y; } tmp = tmp; for (char c = 'k'; tmp > 0 && c <= 'y'; c++) { int y = min(cnt[c],tmp); tmp -= y; cnt[c] -= y; } tmp = tmp; for (char c = 'u'; tmp > 0 && c <= 'y'; c++) { int y = min(cnt[c],tmp); tmp -= y; cnt[c] -= y; } sum['z'] = 0; for (char c = 'y'; c >= 'a'; c--) sum[c] = sum[c+1] + cnt[c]; x = min({sum['y'],sum['u']/2,sum['l']/3}); ans += x; cnt['y'] -= x; tmp = x; for (char c = 'l'; tmp > 0 && c <= 'y'; c++) { int y = min(cnt[c],tmp); tmp -= y; cnt[c] -= y; } tmp = x; for (char c = 'u'; tmp > 0 && c <= 'y'; c++) { int y = min(cnt[c],tmp); tmp -= y; cnt[c] -= y; } sum['z'] = 0; for (char c = 'y'; c >= 'a'; c--) sum[c] = sum[c+1] + cnt[c]; x = min({sum['y'],sum['v']/2}); ans += x; cout << ans << endl; return 0; }