#include #include #define rep(i,a,b) for(int i=a;i=a;i--) #define all(x) (x).begin(),(x).end() #define pb(x) push_back(x); templatebool chmax(T &a, const T &b) { if (abool chmin(T &a, const T &b) { if (b; const ll mod=998244353; //const ll mod=1e9+7; int dx[4]={1,0,-1,0}; int dy[4]={0,1,0,-1}; const string zton="0123456789"; const string atoz="abcdefghijklmnopqrstuvwxyz"; const ll inf=(1ll<<60); ll gcd(ll a,ll b){ ll r; r=a%b; if(r==0){ return b; } else{ return gcd(b,r); } } typedef pair P; int main(void){ int N;cin >> N; int A[N];rep(i,0,N)cin >> A[i]; sort(A,A+N); int pre=0; int cnt=1; ll ans=1; rep(i,0,N){ ans*=(i+1); if(A[i]!=pre){ pre=A[i]; cnt=1; } else{ cnt++; } ans/=cnt; } cout << ans << endl; }