import math from collections import Counter n = int(input()) a = list(map(int,input().split())) c = Counter(a) ans = math.factorial(n) for key in c.keys(): ans//= math.factorial( c[key]) print(ans)