from collections import defaultdict from math import factorial n=int(input()) a=list(map(int,input().split())) d=defaultdict(int) for i in a: d[i]+=1 ans=factorial(n) for val in d.values(): ans//=factorial(val) print(ans)