import math import collections n = int(input()) a = list(map(int, input().split())) ans = math.factorial(n) for val in collections.Counter(a).values(): ans //= math.factorial(val) print(ans)