using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Numerics; using System.Text; //using static CompLib.CompLib; //using DataStructure; namespace atcoder { class Program { const int intMax = 1000000000; const long longMax = 2000000000000000000; static void Main(string[] args) { int N = int.Parse(Console.ReadLine()); var A = Console.ReadLine().Split().Select(int.Parse).ToArray(); long all = 0; for (int i = 1; i <= N; i++) { if (i == 1) all = i; else all *= i; } var list = new long[N + 1]; for (int i = 0; i < N; i++) { list[A[i]]++; } long p = 1; for (int i = 0; i < N; i++) { if (list[i] > 0) { for (long j = 1; j <= list[i]; j++) { p *= j; } } } Console.WriteLine(all / p); } } }