from collections import Counter N = int(input()) A = list(map(int,input().split())) D = list(Counter(A).items()) D.sort(reverse= True) ans = 1 for x,c in D: while c > 0: ans *= N / c c -= 1 N -= 1 print(int(ans))