/* -*- coding: utf-8 -*- * * 1904.cc: No.1904 Never giving up! - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 20; /* typedef */ typedef long long ll; /* global variables */ int as[MAX_N]; ll fs[MAX_N + 1]; /* subroutines */ /* main */ int main() { int n; scanf("%d", &n); for (int i = 0; i < n; i++) scanf("%d", as + i); sort(as, as + n); fs[0] = 1; for (int i = 1; i <= n; i++) fs[i] = fs[i - 1] * i; ll p = 1; for (int i = 0; i < n;) { int j = i; while (i < n && as[j] == as[i]) i++; p *= fs[i - j]; } printf("%lld\n", fs[n] / p); return 0; }