#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using LL = long long;
const int N = 3005;
const int M = 16;
const int mod = 998244353;
int pri[M] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 42, 47, 53};
ll binPow(ll a, ll k = mod - 2) {
ll res = 1;
while (k) {
if (k & 1) res = res * a % mod;
a = a * a % mod;
k >>= 1;
}
return res;
}
void solve() {
int n; cin >> n;
vector<int> a(n);
vector<vector<array<int, 2>>> p(N);
for (int i = 0;i < n;i++) {
cin >> a[i];
int P = a[i];
int tag = 0;
for (int j = 0;j < M;j++) {
if (P % pri[j] == 0) {
tag |= (1 << j);
}
while (P % pri[j] == 0) P /= pri[j];
}
p[P].push_back({a[i], tag});
}
vector<ll> f(1 << M, 0LL);
f[0] = 1;
for (int i = 1;i <= N - 5;i++) {
if (p[i].empty()) continue;
vector<ll> g(1 << M, 0LL);
for (auto [val, tag] : p[i]) {
for (int z = (1 << M) - 1;z >= 0;z--) {
g[z | tag] += ((f[z] + g[z]) % mod) * val % mod;
g[z | tag] %= mod;
}
}
if (i == 1) val = 1LL;
else val = 1LL * (i - 1) * binPow(i) % mod;
for (int z = 0;z < (1 << M);z++) {
f[z] += g[z] * val % mod;
f[z] %= mod;
}
}
ll res = 0;
for (int z = 0;z < (1 << M);z++) {
for (int i = 0;i < M;i++) {
if ((z >> i) & 1) {
f[z] %= mod;
f[z] *= 1LL * (pri[i] - 1) * binPow(pri[i]) % mod;
f[z] %= mod;
}
}
res = (res + f[z]) % mod;
}
cout << res << '\n';
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
solve();
return 0;
}