N=int(input()) A=list(map(int,input().split())) ANS=1 B=sorted(A) C=1 X=1 for i in range(1,N): if B[i-1]==B[i]: C+=1 X*=C else: C=1 ANS*=(i+1) print(ANS//X)