#pragma GCC optimize ("-O3","unroll-loops")
#include<iostream>
#include<string>
#include<algorithm>
#include<vector>
#include<queue>
#include<map>
#include<math.h>
#include<iomanip>
#include<set>
#include<numeric>
#include<cstring>
#include<cstdio>
#include<functional>
#include<bitset>
#include<limits.h>
#include<cassert>
#include<iterator>
#include<complex>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<time.h>
#include <random>

using namespace std;

#define REP(i, n) for(int i = 0;i < n;i++)
#define REPR(i, n) for(int i = n;i >= 0;i--)
#define FOR(i, m, n) for(int i = m;i < n;i++)
#define FORR(i, m, n) for(int i = m;i >= n;i--)
#define SORT(v, n) sort(v, v+n);
#define VSORT(v) sort(v.begin(), v.end());
#define REVERSE(v,n) reverse(v,v+n);
#define VREVERSE(v) reverse(v.begin(), v.end());
#define ll long long
#define pb(a) push_back(a)
#define print(x) cout<<x<<'\n';
#define pe(x) cout<<x<<" ";
#define lb(v,n) lower_bound(v.begin(), v.end(), n);
#define ub(v,n) upper_bound(v.begin(), v.end(), n);
#define int long long
#define all(x) (x).begin(), (x).end()
#define print_space(v) REP(i,v.size())cout << v[i] << ((i == v.size() - 1) ? "\n" : " ");
//#define double long double



template<typename T1, typename T2> inline void chmin(T1 &a, T2 b) { if (a>b) a = b; }
template<typename T1, typename T2> inline void chmax(T1 &a, T2 b) { if (a<b) a = b; }

const int MOD = 998244353;
const ll INF = 1e17;
const int INT_INF = 1e9;
const double pi = acos(-1);
const double EPS = 1e-10;
typedef pair<int, int>P;
const int MAX = 1000020;

vector<int>mults[1000010];

long long fac[MAX], finv[MAX], inv[MAX];

// テーブルを作る前処理
void COMinit() {
	fac[0] = fac[1] = 1;
	finv[0] = finv[1] = 1;
	inv[1] = 1;
	for (int i = 2; i < MAX; i++) {
		inv[i] = MOD - inv[MOD%i] * (MOD / i) % MOD;
	}
}


ll add(ll x, ll y) {
	x += y;
	if (x >= MOD) return x - MOD;
	return x;
}
ll sub(ll x, ll y) {
	x -= y;
	if (x < 0) return x + MOD;
	return x;
}

ll mult(ll x, ll y) {
	return (x * y) % MOD;
}
ll bin_pow(ll x, ll p) {
	if (p == 0) return 1;
	if (p & 1) return mult(x, bin_pow(x, p - 1));
	return bin_pow(mult(x, x), p / 2);
}

vector<int>divs[1000001];
void divi(int x) {
	for (int i = 1; i*i <= x; i++) {
		if (x%i == 0) {
			//print(i);
			divs[x].pb(i);
			mults[i].pb(x);
			if (i*i == x)continue;
			//print(x / i);
			divs[x].pb(x / i);
			mults[x/i].pb(x);
		}
	}
}


bool used[1000001];

int A[200020];
int C[1000010];
bool calculatet_inv[1000010];
//int inv[1000010];
//int inverse(int x) {
//	if (calculatet_inv[x])return inv[x];
//	else {
//		inv[x] = bin_pow(x, MOD - 2);
//		calculatet_inv[x] = true;
//		return inv[x];
//	}
//}
void solve() {
	int N; cin >> N;
	int mx = 0;
	REP(i, N) {
		int tmp; cin >> tmp;
		A[i] = tmp;
		if (used[tmp]) {
			for (auto x : divs[tmp]) {
				mults[x].pb(tmp);
			}
		}
		else {
			divi(tmp);
			mx = max(mx, tmp);
			used[tmp] = true;
		}
	}
	COMinit();
	FOR(i, 1, mx + 1) {
		C[i] = inv[i];
		//C[i] = bin_pow(i, MOD - 2);
		//pe(i)print(C[i]);
	}
	for (int i = 1; i <= mx; i++) {
		for (int j = 2 * i; j <= mx; j += i) {
			C[j] = sub(C[j], C[i]);
		}
	}
	/*FOR(i, 1, mx + 1) {
	int tmp = bin_pow(C[i], MOD - 2);
	pe(i)print(tmp);
	}*/
	ll ans = 0;
	FOR(i, 1, mx + 1) {
		int tmp = 0;
		//print(i);
		for (auto x : mults[i]) {
			tmp = add(tmp, x);
			//pe(x);
		}//cout << endl;
		tmp = mult(tmp, tmp);
		tmp = mult(tmp, C[i]);
		ans = add(ans, tmp);
	}
	REP(i, N) {
		ans = sub(ans, A[i]);
	}
	ans = mult(ans, inv[2]);
	//ans = mult(ans, bin_pow(2, MOD - 2));
	print(ans);
}

signed main() {
	cin.tie(0);
	ios::sync_with_stdio(false);

	solve();
}


Measured memory_bytes: 155232