#pragma region
#include <bits/stdc++.h>
using namespace std;
using ii = pair<int, int>;
using ll = long long;
using vi = vector<int>;
using vll = vector<ll>;

#define f first
#define s second
#define szof(a) (int)a.size()
#define allof(a) a.begin(), a.end()

void pr(int x) { printf("%d", x); }
void pr(ll x) { printf("%lld", x); }
void pr(char x) { printf("%c", x); }
void pr(const string &x) { printf("%s", x.c_str()); }
void pr(bool x) { printf(x ? "true" : "false"); }
void pr(double x) { printf("%lf", x); }
void pr(const char *x) { printf("%s", x); }

template <typename S, typename T>
void pr(pair<T, S> x);

template <class T>
void pr(const T &x);

template <class T, class... Ts>
void pr(const T &t, const Ts &... ts) {
    pr(t);
    pr(ts...);
}
template <class T1, class T2>
void pr(const pair<T1, T2> &x) {
    pr("{", x.f, ", ", x.s, "}");
}
template <class T>
void pr(const T &x) {
    pr("{");
    bool fst = 1;
    for (const auto &a : x)
        pr(!fst ? ", " : "", a), fst = 0;
    pr("}");
}

void ps() { pr("\n"); }
template <class T, class... Ts>
void ps(const T &t, const Ts &... ts) {
    pr(t);
    if (sizeof...(ts)) pr(" ");
    ps(ts...);
}
void pc() { pr("]\n"); }
template <class T, class... Ts>
void pc(const T &t, const Ts &... ts) {
    pr(t);
    if (sizeof...(ts)) pr(", ");
    pc(ts...);
}
#define debug(x...) pr("[", #x, "] = ["), pc(x)
#ifndef LOCAL
#define debug(x...) 42
#endif
#pragma endregion

const int HIGH = 1000000;
int sp[1000006];
void sieve() {
    fill(sp, sp + HIGH + 1, -1);
    for (int i = 2; i <= HIGH; ++i)
        sp[i] = i;
    for (int i = 2; i * i <= HIGH; ++i) {
        if (sp[i] == i) {
            for (int j = i * i; j <= HIGH; j += i) {
                if (sp[j] == j) sp[j] = i;
            }
        }
    }
}
vector<ii> factorize(int n) {
    // assert(n > 0 && n <= HIGH);
    vector<ii> f;
    while (sp[n] != -1) {
        int p = sp[n];
        f.push_back({ p, 0 });
        while (sp[n] == p) {
            ++f.back().second;
            n /= p;
        }
    }
    return f;
}

vector<int> all_factors(const vector<ii> &pf) {
    vector<int> ans = { 1 }, newf;
    for (int i = 0; i < pf.size(); ++i) {
        int p = pf[i].first, e = pf[i].second;
        newf.clear();
        for (int old : ans) {
            for (int j = 1, x = p; j <= e; ++j, x *= p) {
                newf.push_back(old * x);
            }
        }
        for (int f : newf) {
            ans.push_back(f);
        }
    }
    return ans;
}
const int 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[200005];
int sum[1000006];

int powmod(int a, int e) {
    int res = 1;
    while (e) {
        if (e & 1) res = mul(res, a);
        a = mul(a, a);
        e /= 2;
    }
    return res;
}

int read_int() {
    int c, o = 0;
    while ((c = getchar()) < '0')
        ;
    do {
        o = (o << 3) + (o << 1) + (c - '0');
    } while ((c = getchar()) >= '0');
    return o;
}

int g[500];

int main() {
#ifdef LOCAL
    freopen("data.txt", "r", stdin);
#endif
    sieve();
    n = read_int();
    for (int i = 1; i <= n; ++i) {
        // scanf("%d", a + i);
        a[i] = read_int();
    }
    int occ = 1;
    for (int i = 1; i <= n; ++i) {
        if (a[i] == a[i + 1]) {
            ++occ;
            continue;
        }
        auto pf = factorize(a[i]);
        auto f = all_factors(pf);
        for (auto F : f)
            sum[F] = add(sum[F], mul(occ, a[i]));
        occ = 1;
    }

    int ans = 0;
    occ = 1;
    sort(a + 1, a + n + 1);
    for (int i = 1; i <= n; ++i) {
        if (a[i] == a[i + 1]) {
            ++occ;
            continue;
        }
        auto pf = factorize(a[i]);
        auto f = all_factors(pf);
        sort(allof(f), greater<int>());
        int res = 0;
        for (int i = 0; i < szof(f); ++i) {
            g[i] = sum[f[i]];
            for (int j = 0; j < i; ++j) {
                if (f[j] % f[i] == 0) {
                    g[i] = add(g[i], -g[j]);
                }
            }
            res = add(res, mul(g[i], powmod(f[i], MOD - 2)));
        }
        res = mul(res, a[i]);
        res = mul(res, occ);
        ans = add(ans, res);

        occ = 1;
    }
    for (int i = 1; i <= n; ++i) {
        ans = add(ans, -a[i]);
    }
    ans = mul(ans, powmod(2, MOD - 2));
    if (ans < 0) ans += MOD;
    printf("%d\n", ans);
}

Measured memory_bytes: 8832