N = int(input()) A = list(map(int, input().split())) D = [0] * 25 fact = [1] * (N + 1) for i in range(1, N + 1): fact[i] = fact[i - 1] * i for a in A: D[a] += 1 ans = fact[N] for i in range(25): ans //= fact[D[i]] print(ans)