#include<algorithm>
#include<chrono>
#include<climits>
#include<numeric>
#include<iomanip>
#include<iostream>
#include<map>
#include<queue>
#include<random>
#include<set>
#include<stack>
#include<unordered_map>
#include<unordered_set>
#include<vector>
#include<cassert>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<cmath>
#include<string>
using namespace std;
 
struct Debug{
    int cnt = 0;
    bool on = false;
    char debug[10] = "debug";
    template<class T>
    Debug & operator<<(const T & v) {
        if(on && cnt++ == 0) cerr << "debug: ";
        if(on) cerr << v << ' ';
        return *this;
    }
    Debug & operator<<(ostream&(*pManip)(ostream&)) {
        if(on) cerr << (*pManip);
        cnt = 0;
        return *this;
    }
} debug;
#define rep(i, a, b) for(auto i = (a); i < (b); i++)
#define rrep(i, a, b) for(auto i = (a); i > (b); i--)
#define all(v) (v).begin(), (v).end()
#define print(v) {if(debug.on){for(auto x : v) debug << x; debug << endl;}}
#define printn(v, n) {if(debug.on){for(int _i = 0; _i < n; _i++) debug << *(v + _i); debug << endl;}}
 

typedef unsigned long long ull;
typedef long long ll;
 
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef pair<double, double> pdd;
 
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef vector<vvi> vvvi;
typedef vector<pii> vpii;

struct mint{
    long long x;
    long long mod = 998244353;
    
    mint(): x(0) {}
    mint(long long _x) { x = _x % mod; }
    //operator long long() { return x; }

    mint operator+(const mint & b) const { return (x + b.x) % mod; }
    mint operator-(const mint & b) const { return (x - b.x + mod) % mod; }
    mint operator*(const mint & b) const { return (x * b.x) % mod; }

    template<class T>
    mint operator^(T b) const {
        if(!b) return 1;
        mint tmp = (*this) ^ (b / 2);
        return b % 2 ? tmp * tmp * (*this) : tmp * tmp;
    }

    mint inv() const { 
        static unordered_map<long long, long long> inv_dp;
        if(inv_dp.count(x))
            return inv_dp[x];
        else if(inv_dp.size() < 1000000)
            return mint(inv_dp[x] = ((*this) ^ (mod - 2)).x);
        else return (*this) ^ (mod - 2);
    }
    
    mint operator/(const mint & b) const { return (*this) * b.inv(); }
};

const int MAXN = 2e5 + 20, MAXM = 1e6 + 10;
int n, m = 1e6;
long long a[MAXN];
mint w[MAXM];
long long cnt[MAXM] = {};

int main(int argc, char * argv[]) {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    if(argc > 1 && !strcmp(argv[1], debug.debug)) debug.on = true;

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

    m = *max_element(a, a + n);


    for(int i = 1; i <= m; i++)
    	w[i] = mint(1) / mint(i);
    for(int i = 1; i <= m; i++) {
    	for(int j = 2; j <= m / i; j++) {
    		w[i * j] = w[i * j] - w[i];
    	}
    }

    for(auto x : a)
    	cnt[x]++;

    mint res = 0;
    for(int i = m; i >= 1; i--) {
    	mint tmp = 0;
    	for(int j = 1; j <= m / i; j++) {
    		tmp = tmp + mint(cnt[i * j] * i * j);
    	}
    	res = res + w[i] * tmp * tmp;
    }
    for(auto x : a)
    	res = res - mint(x);
    res = res / mint(2);
    cout << res.x << endl;


    return 0;
}






















Measured memory_bytes: 64784