
class Heap
  attr_accessor :heap, :type, :compare, :last

  def initialize(type = :min)
    @type = type
    if @type == :min
      @heap = [-1.0/0]
      @compare = ->(a,b) { (a <=> b) < 0 }
    elsif @type == :max
      @heap = [1.0/0]
      @compare = ->(a,b) { (a <=> b) > 0 }
    else
      raise "Unknown heap type"
    end
    @last = 0
  end

  def dupl
    heap = Heap.new
    heap.type = @type
    heap.compare = @compare
    heap.last = @last
    heap.heap = @heap.dup
    heap
  end

  def push(value)
    @last += 1
    @heap[@last] = value
    bubble_up(@last)
    @last
  end

  def peek
    @heap[1]
  end

  def pop
    return nil if @last == 0
    value = @heap[1]
    @heap[1] = @heap[@last]
    @last -= 1
    bubble_down(1)
    value
  end

  def size
    @last
  end

  private
  def bubble_up(child)
    return if child == 1
    parent_index = parent(child)
    if @compare[@heap[child], @heap[parent_index]]
      @temp = @heap[child]
      @heap[child] = @heap[parent_index]
      @heap[parent_index] = @temp
      bubble_up(parent_index)
    end
  end

  def bubble_down(parent_index)
    return if parent_index > parent(@last)
    left = left_child(parent_index)
    right = right_child(parent_index)

    if right > @last
      child = left
    else
      child = @compare[@heap[left], @heap[right]] ? left : right
    end

    if @compare[@heap[child], @heap[parent_index]]
      @temp = @heap[child]
      @heap[child] = @heap[parent_index]
      @heap[parent_index] = @temp
      bubble_down(child)
    end

  end

  def parent(index)
    index / 2
  end

  def left_child(index)
    2 * index
  end

  def right_child(index)
    2 * index + 1
  end
end

N = gets.to_i
AS = gets.split.map(&:to_i)

counter = Array.new(N+1,0)

targets = {}
AS.each do |a|
  counter[a] += 1
  targets[a] = true
end

heap_orig = Heap.new(:max)
targets.keys.each do |t|
  heap_orig.push(counter[t])
end

p N
2.upto(N) do |i|
  heap = heap_orig.dupl

  ret = 0
  curr = []
  loop do
    i.times { curr << heap.pop }
    # p curr
    if curr.last.nil?
      p ret
      break
    else
      min = curr.min
      ret += min
      j = 0
      # p '-=----------'
      # p [curr,min,ret]
      # p '-=----------'
      while j < curr.length
        rest = curr[j] - min
        if rest != 0
          heap.push(rest)
        else
          break
        end
        j += 1
      end
    end
  end
end
