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