#!usr/bin/env python3 from collections import defaultdict, deque from heapq import heappush, heappop from itertools import permutations, accumulate import sys import math import bisect def LI(): return [int(x) for x in sys.stdin.readline().split()] def I(): return int(sys.stdin.readline()) def IR(n): return [I() for _ in range(n)] def LIR(n): return [LI() for _ in range(n)] sys.setrecursionlimit(1000000) mod = 1000000007 def main(): n = I() a = LI() a.sort() count = defaultdict(lambda : 0) for i in a: count[i] += 1 count = list(count.items()) count.sort() p = 1 q = 1 res = n for _, j in count: for i in range(1,j+1): p *= i q *= n n -= 1 print(q//p) return if __name__ == "__main__": main()