from math import factorial from itertools import groupby n = int(input()) f = 1 for x in (len(list(x)) for (_, x) in groupby(sorted(map(int, input().split())))): f *= factorial(x) print(factorial(n) // f)