N = gets.to_i S = gets.chomp.chars.sort.reverse T = 'yuki' queue = S ans = 0 stock = [] 5.times do |i| next_que = [] next_stock = [] until queue.empty? s = queue.shift if i == 4 if stock.size > 0 ans += 1 stock.shift end next end if T[i] > s next_que << s next end if T[i] < s if i == 0 ans += 1 elsif stock.size > 0 ans += 1 stock.shift end else if i == 0 next_stock << s elsif stock.size > 0 str = stock.shift str << s next_stock << str else next_que << s end end end queue = next_que stock = next_stock end puts ans