N=int(input()) fact = [1]*21 for i in range(20): fact[i+1]=fact[i]*(i+1) ans=fact[N] from collections import Counter C=Counter([int(x) for x in input().split()]) for c in C: ans//=fact[C[c]] print(ans)