#!/usr/bin/env python3 from collections import defaultdict N = int(input()) A = list(map(int, input().split())) countA = defaultdict(int) for a in A: countA[a] += 1 ret = 1 for i in range(N): ret *= i + 1 for key, val in countA.items(): for i in range(val): ret //= i + 1 print(ret)