#include using namespace std; #include using namespace atcoder; using ll = long long; using vi = vector; using vvi = vector>; using pii = pair; #define rep(i, n) for (int i = 0; i < (int)(n); ++i) #define repr(i, n) for (int i = (int)(n - 1); i >= 0; --i) int main() { int n; cin >> n; map mp; rep(i, n) { int a; cin >> a; mp[a]++; } vector fac(n + 1); fac[0] = 1; rep(i, n) fac[i + 1] = fac[i] * (i + 1); ll ret = fac[n]; for (auto [_, k] : mp) ret / fac[k]; cout << ret << endl; return 0; }