#yuki1904 import collections import math n=int(input()) a=list(map(int,input().split())) res=math.factorial(n) for x in collections.Counter(a).values(): res//=math.factorial(x) print(res)