from collections import Counter from math import factorial, prod N = int(input()) A = list(map(int, input().split())) freq = Counter(A) num = factorial(N) den = prod([factorial(v) for v in freq.values()]) ans = num // den print(ans)