#pragma GCC optimize("Ofast")
#pragma GCC optimize("no-stack-protector")
#pragma GCC optimize("unroll-loops")
#pragma GCC optimize("fast-math")
#pragma GCC target("sse,sse2,sse3,ssse3,popcnt,abm,mmx,tune=native")
#include <iostream>
#include <vector>
#include <algorithm>
#include <set>
#include <map>
#include <unordered_set>
#include <unordered_map>
#include <stdio.h>
#include <cstdio>
#include <math.h>
#include <cmath>
#include <string>
#include <cstring>
#include <queue>
#include <deque>
#include <random>
#include <iomanip>
#include <bitset>
#include <cassert>

using namespace std;


#define less less228
#define left left228
#define right right228

template<typename T> void uin(T &a, T b) {
    if (b < a) a = b;
}
template<typename T> void uax(T &a, T b) {
    if (b > a) a = b;
}


random_device rnd;

template<typename T> void shuffle(vector< T > &v) {
    for (int i = 1; i < (int)v.size(); ++i) {
        swap(v[rnd() % i], v[i]);
    }
    for (int i = (int)v.size() - 1; i; --i) {
        swap(v[rnd() % i], v[i]);
    }
}

const int MOD = 998244353;
const int N = 200 * 1000 + 228, C = 1000 * 1000 + 228;

long long mod(long long x) {
    x %= MOD;
    if (x < 0) x += MOD;
    return x;
}

long long fp(long long a, long long b) {
    long long res = 1;
    for (; b; b >>= 1) {
        if (b & 1) res = mod(res * a);
        a = mod(a * a);
    }
    return res;
}

int gcd(int a, int b) {
    if (b == 0) return a;
    return gcd(b, a % b);
}

int n;
int a[N];
long long pairs[C], cnt[C];

signed main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cin >> n;
    int mx = 0;
    for (int i = 1; i <= n; ++i) {
        cin >> a[i];
        uax(mx, a[i]);
        ++cnt[a[i]];
    }

    long long res = 0;
    for (int g = mx; g; --g) {
        long long SUM = 0;
        long long SUM2 = 0;
        for (int x = 1; x * g <= mx; ++x) {
            SUM = mod(SUM + cnt[x * g] * (x * g));
            SUM2 = mod(SUM2 + cnt[x * g] * (x * g) * (x * g));
        }
        SUM %= MOD;
        SUM2 %= MOD;
        pairs[g] = mod(SUM * SUM - SUM2);
        if (pairs[g]) pairs[g] = mod(pairs[g] * fp(2, MOD - 2));
        for (int x = 2; x * g <= mx; ++x) {
            pairs[g] = mod(pairs[g] - pairs[x * g]);
        }
        if (pairs[g]) {
            res = mod(res + pairs[g] * fp(g, MOD - 2));
        }
    }
    res %= MOD;
    cout << res << '\n';
    return 0;

}
// RU_023

/*
Нестеренкококо
нос тёр енко)))
ееео

shironury

boootgslkfjdaojfdopsjfopjso
pgjq]pogjopsjg\qrwjopg
j
pogjqwrjgp]oqwjjqw]pjljfojpjowjow4jgopja    ohbip]aeo'rogpoaj0
[bkrw
pojgqwjp\\j\;sync_with_stdiojp
ojeofmpworuc[owejgoprwig
[sdkz
pgj
p[gjes
p0ghjqsp[

jg
prsjgopjg]prwjgoprejgopjrepogjrepog]jgoprejgrgjporeqjgoperjgoprejgopeqrjgopeqrjgoprqwjgpoqjrwsopt4ng\ojsbjsoprnbfqsn\bvhqerpogjorwo
pwewh\rwh \wjiowe orw jop jgr\p jpj o jopj gr\pj p gjop j\pj\pe jp'oj [
 k
 p[eq   fj\pjfdwj\ejopjojopjopjf;'djpfsj, ipojs\p gpsdigsj gorkgjgjrogjdojgiao'fsdvopdshpdfidopcnweojccodj [cjd;ofjd[jdspmcojc"ajno[:Afvoq[w0shbprs`nm/jP{Vadmn;'fnc[Ajojsfpfjcffor 9int i= ; 1 < nfor (int i =1; for (int i =1 ; i <= n: ++i) frfor (int j = 1; j <= ml; ++'}]]]]]]]]]
5
1 5
1 2
2 3
2 4
*/

Measured memory_bytes: 16640