import sys,random,bisect from collections import deque,defaultdict from heapq import heapify,heappop,heappush from itertools import cycle, permutations from math import log,gcd input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) N = int(input()) A = li() cnt = [0] * (N+1) g1 = [1] * (N+1) for i in range(1,N+1): g1[i] = i * g1[i-1] for a in A: cnt[a] += 1 res = g1[N] for i in range(1,N+1): res //= g1[cnt[i]] print(res)