n = gets.to_i
a = gets.split.map(&:to_i)
h = Hash.new(0)
a.each do |x|
  h[x] += 1
end
def nPk(n, k)
  r = 1
  while k > 0
    r *= n
    n -= 1
    k -= 1
  end
  r
end
ans = h[0]
2.upto(a.max) do |x|
  ans *= h[x - 1] ** h[x]
end
puts ans