#include <bits/stdc++.h>
using namespace std;


template<int64_t mod>
struct modint {
    using LL = int64_t;
    LL val;
    modint(LL val=0) : val(((val % mod) + mod) % mod) {}

    const modint operator+() const { return *this; }
    const modint operator-() const { return (-val + mod) % mod; }
    const modint inv() const { return pow(mod-2); }

    modint& operator+=(const modint& rhs) {
        (val += rhs.val) %= mod;
        return *this;
    }
    modint& operator-=(const modint& rhs) {
        return *this += -rhs;
    }
    modint& operator*=(const modint& rhs) {
        (val *= rhs.val) %= mod;
        return *this;
    }
    modint& operator/=(const modint& rhs) {
        return *this *= rhs.inv();
    }

    const modint operator+(const modint& rhs) const {
        return modint(*this) += rhs;
    }
    const modint operator-(const modint& rhs) const {
        return modint(*this) -= rhs;
    }
    const modint operator*(const modint& rhs) const {
        return modint(*this) *= rhs;
    }
    const modint operator/(const modint& rhs) const {
        return modint(*this) /= rhs;
    }

    const modint pow(LL n) const {
        modint ret = 1, tmp = val;
        while (n > 0) {
            if (n & 1) ret *= tmp;
            tmp *= tmp; n >>= 1;
        }
        return ret;
    }

    bool operator==(const modint& rhs) const { return val == rhs.val; }
    bool operator!=(const modint& rhs) const { return !(*this == rhs); }

    friend const modint operator+(const LL& lhs, const modint& rhs) {
        return modint(lhs) + rhs;
    }
    friend const modint operator-(const LL& lhs, const modint& rhs) {
        return modint(lhs) - rhs;
    }
    friend const modint operator*(const LL& lhs, const modint& rhs) {
        return modint(lhs) * rhs;
    }
    friend const modint operator/(const LL& lhs, const modint& rhs) {
        return modint(lhs) / rhs;
    }

    friend bool operator==(const LL& lhs, const modint& rhs) {
        return modint(lhs) == rhs;
    }
    friend bool operator!=(const LL& lhs, const modint& rhs) {
        return modint(lhs) != rhs;
    }

    friend ostream& operator<<(ostream& os, const modint& a) {
        return os << a.val;
    }
    friend istream& operator>>(istream& is, modint& a) {
        LL tmp; is >> tmp;
        a = tmp;
        return is;
    }
};



// O(NloglogN)
template<typename T>
vector<T> fast_mobius_transform_prime(const vector<T>& g) {
    // Return f(d):
    // s.t. g(d) = \sum_{d | n} f(n)
    // ( e.g. f(d) = \sum_{d | n} mu(n / d) * g(n) )
    int n = g.size();
    vector<T> f = g;
    vector<bool> sieve(n, true);
    for (int p = 2; p < n; ++p) {
        if (!sieve[p]) continue;
        for (int i = 1; i * p < n; ++i) {
            sieve[i * p] = false;
            f[i] -= f[i * p];
        }
    }
    return f;
}

using LL = int64_t;
const LL MOD = 998244353;
using Int = modint<MOD>;

int main()
{
    int n; cin >> n;
    vector<LL> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    int maxA = *max_element(a.begin(), a.end());
    vector<Int> cnt(maxA+1);
    for (int i = 0; i < n; ++i) {
        cnt[a[i]] += 1;
    }

    vector<Int> g(maxA+1);
    for (int d = 1; d <= maxA; ++d) {
        Int s = 0, ss = 0;
        for (LL k = d; k <= maxA; k += d) {
            s += cnt[k] * k;
            ss += cnt[k] * k * k;
        }
        g[d] = (s * s - ss) / 2;
    }

    vector<Int> f = fast_mobius_transform_prime(g);

    Int ans = 0;
    for (int d = 1; d <= maxA; ++d) {
        ans += f[d] / d;
    }

    cout << ans << endl;

    return 0;
}


Measured memory_bytes: 25344