import sys from sys import stdin import math N = int(stdin.readline()) A = list(map(int,stdin.readline().split())) dic = {} for i in A: if i not in dic: dic[i] = 0 dic[i] += 1 x = math.factorial(N) for i in dic: x //= math.factorial(dic[i]) print (x)