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(20) ans = K for x,c in D: while c > 0: ans *= N // c c -= 1 N -= 1 print(ans//K)