#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e6, MOD = 998244353;
int add(int a, int b) { return (a + b) % MOD; }
int mul(int a, int b) { return 1LL * a * b % MOD; }

int n, a[200000], sum[MAX + 1], w[MAX + 1], inv[MAX + 1];
int main() {
    scanf("%d", &n);
    int ans = 0;
    for (int i = 0; i < n; ++i) {
        scanf("%d", a + i);
        sum[a[i]] = add(sum[a[i]], a[i]);
        ans = add(ans, -a[i]);
    }

    inv[1] = 1;
    for (int i = 2; i <= MAX; ++i) inv[i] = -mul(MOD / i, inv[MOD % i]);

    for (int d = 1; d <= MAX; ++d) {
        w[d] = add(w[d], inv[d]);
        int s = sum[d];
        for (int e = 2 * d; e <= MAX; e += d) s = add(s, sum[e]), w[e] = add(w[e], -w[d]);
        ans = add(ans, mul(w[d], mul(s, s)));
    }

    ans = mul(ans, inv[2]);
    if (ans < 0) ans += MOD;
    printf("%d\n", ans);
}