#include <bits/stdc++.h>
#define f first
#define s second
using namespace std;
using ll = long long;
using ii = pair<int, int>;
constexpr int S = 1e6+6e1;
constexpr ll MOD = 998244353;

ll pw(ll base, ll exp) {
	ll res = 1;
	while (exp) {
		if (exp & 1) (res *= base) %= MOD;
		exp >>= 1, (base *= base) %= MOD;
	}
	return res;
}

ll inv(ll x) { return pw(x, MOD - 2); }

ll A[200002], sum[S], cur[S];

int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);

	int N; cin >> N;
	for (int i = 0; i < N; ++i) cin >> A[i];

	for (int i = 0; i < N; ++i) (sum[A[i]] += A[i]) %= MOD;
	for (int i = 1; i < S; ++i) {
		for (int j = 2 * i; j < S; j += i) (sum[i] += sum[j]) %= MOD;
	}

	ll ans = 0;
	for (int i = 1; i < S; ++i) {
		ll r = (inv(i) - cur[i] + MOD) % MOD;
		(ans += (sum[i] * sum[i]) % MOD * r) %= MOD;
		for (int j = 2 * i; j < S; j += i) (cur[j] += r) %= MOD;
	}

	for (int i = 0; i < N; ++i) (ans += MOD - A[i]) %= MOD;

	cout << inv(2) * ans % MOD;
}