#include using namespace std; #include "atcoder/all" using namespace atcoder; using Mint = modint998244353; int main() { int N; cin >> N; vector A(N); map mp; Mint maine = 1; for (auto&& a : A) { cin >> a; mp[a]++; maine *= a; } Mint ans = 0; for (auto&& [a, n] : mp) { Mint book = 1; for (auto&& b : A) { if (b != a) book /= (-Mint{a} * Mint{a} + Mint{b} * Mint{b}); else book /= Mint{2} * a; } ans += book; } ans *= 2; cout << ans.val() << endl; }