_n = gets.to_i
nums = gets.strip.split.map(&:to_i).group_by(&:itself).values.map(&:size).sort
l = nums.size
_n.times do |n|
  arr = Array.new(n+1){0}
  l.times do |m|
    i = arr.index(arr.min)
    arr[i] += nums[l-m-1]
  end
  puts arr.min
end