from collections import Counter n = int(input()) A = sorted(list(map(int,input().split()))) C = Counter(A) ans = 1 base = 1 done = {} num = 0 for a in A[::-1]: if a in done: continue count = C[a] for j in range(count,0,-1): ans *= n-num base *= j num += 1 done[a] = 1 print(ans//base)