from collections import Counter fac = [1] * (21) for i in range(1, 21): fac[i] = fac[i - 1] * i n = int(input()) arr = list(map(int, input().split())) ans = fac[n] for v in Counter(arr).values(): ans //= fac[v] print(ans)