#include using namespace std; #include "atcoder/all" using namespace atcoder; using Mint = modint998244353; vector c(300, vector(300, Mint{1})); vector seen(300, vector(300, false)); Mint C(int n, int k) { if (k < 0 || k > n) return 0; if (seen[n][k]) return c[n][k]; auto& ret = c[n][k]; if (n == 0) return ret = 1; return ret = C(n - 1, k) + C(n - 1, k - 1); } int main() { int N; cin >> N; vector A(N); map mp; for (auto&& a : A) { cin >> a; mp[a]++; } vector> V; for (auto p : mp) { V.push_back(p); } Mint ans = 0; for (auto&& [a, n] : V) { Mint book = 1; vector memo(n); memo[0] = 1; for (auto&& [b, m] : V) { if (b != a) { { vector memo_nxt(n); for (int i = 0; i <= n - 1; i++) { Mint tmp = Mint{1} / Mint{a + b}.pow(m); for (int j = 0;; j++) { if (i + j > n - 1) break; //j回微分 memo_nxt[i + j] += memo[i] * tmp * C(i + j, j); tmp *= -(m + j); tmp /= (a + b); } } swap(memo, memo_nxt); } { vector memo_nxt(n); for (int i = 0; i <= n - 1; i++) { Mint tmp = Mint{1} / Mint{a - b}.pow(m); for (int j = 0;; j++) { if (i + j > n - 1) break; //j回微分 memo_nxt[i + j] += memo[i] * tmp * C(i + j, j); tmp *= -(m + j); tmp /= (a - b); } } swap(memo, memo_nxt); } } } { vector memo_nxt(n); for (int i = 0; i <= n - 1; i++) { Mint tmp = Mint{1} / Mint{2 * a}.pow(n); for (int j = 0;; j++) { if (i + j > n - 1) break; //j回微分 memo_nxt[i + j] += memo[i] * tmp * C(i + j, j); tmp *= -(n + j); tmp /= (2 * a); } } swap(memo, memo_nxt); } book = memo[n - 1]; for (int i = 1; i <= n - 1; i++) { book /= i; } ans += book; } ans *= 2; if (N % 2 == 0) ans *= -1; cout << ans.val() << endl; }