N=int(input()) A=list(map(int,input().split())) Aset = list(set(A)) from collections import Counter from math import gcd cnt = Counter(A) Aset.sort(reverse=True) num=1 den=1 for a in Aset: n = cnt[a] while n: num *= n den *= N g = gcd(num,den) num //= g den //= g n-=1 N-=1 print(den)