#include <stdio.h>
#include <bits/stdc++.h>
#include <atcoder/all>
using namespace atcoder;
using mint = modint998244353;
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000001

int main(){
	
	int n;
	cin>>n;
	
	long long ans = 1;
	rep(i,n)ans *= i+1;
	
	map<long long,int> mp;
	rep(i,n){
		int a;
		cin>>a;
		mp[a]++;
	}
	
	for(auto a:mp){
		rep(j,a.second)ans /= j+1;
	}
	cout<<ans<<endl;
	return 0;
}