class Q
	def initialize ascending=nil
		@h = ascending||[] # min-heap
	end

	def enq(v)
		@h.push(v)
		up_heap
	end

	def deq
		min, last = @h[0], @h.pop
		unless @h.empty?
			@h[0] = last
			dn_heap
		end
		return min
	end

private
	def up_heap
		i, up = @h.size-1, @h[-1]
		while 0 <= (iP = (i-1)/2)
			break unless up < @h[iP]
			@h[i], i = @h[iP], iP
		end
		@h[i] = up
	end

	def dn_heap
		i, dn, size = 0, @h[0], @h.size
		while (iC = 2*i+1) < size
			iC += 1 if iC+1 < size and @h[iC+1] < @h[iC]
			break unless @h[iC] < dn
			@h[i], i = @h[iC], iC
		end
		@h[i] = dn
	end
end

N, *A = $<.read.split.map(&:to_i)

h = Hash.new(0)
A.each{|a|
	h[a] += 1
}
B = h.values.sort

p *(1..N).map{|k|
	next 0 if B.size < k
	q = Q.new(B[-k,k])
	(B.size-k-1).downto(0){|i|
		q.enq q.deq+B[i]
	}
	q.deq
}
