import sys # sys.setrecursionlimit(10 ** 9) # Codeforcesでは350000程度に def input(): return sys.stdin.readline().strip() n = int(input()) A = list(map(int, input().split())) A.sort() ans = 1 for i in range(1, n + 1): ans *= i B = [0] * 21 for i in range(n): B[A[i]] += 1 for i in range(21): for j in range(1, B[i] + 1): ans //= j print(ans)