#include <bits/stdc++.h>
#include <boost/format.hpp>
#include <boost/integer/common_factor_rt.hpp>
#include <boost/multiprecision/cpp_int.hpp>
#include <boost/optional.hpp>

#ifdef DEBUG
#include "libs/debug.cpp"
#define DEBUG 1
#else
#define DEBUG 0
#endif

#define rep(i, n) repr((i), 0, (n))
#define repr(i, a, t) reps((i), (a), (t), 1)
#define reps(i, a, t, s) for (long long (i) = (a); (i) < (long long)(t); (i) += (s))
#define rrep(i, n) rrepr((i), (n) - 1, 0)
#define rrepr(i, a, t) rreps((i), (a), (t), 1)
#define rreps(i, a, t, s) for (long long (i) = (a); (i) >= (long long)(t); (i) -= (s))
#define each(v, c) for (auto &&(v) : (c))
#define all(c) (c).begin(), (c).end()

using namespace std;
namespace mp = boost::multiprecision;
using ll = long long;
using ull = unsigned long long;
using ld = long double;
using ml = mp::cpp_int;
template<typename T>
using optional = boost::optional<T>;
const auto none = boost::none;
const long long MOD = 998244353;
const long long INF = 1e18;

/**
 * x ** y % mod
 * @param x
 * @param y
 * @param mod
 */
long long mod_pow(long long x, long long y, long long mod) {
  long long ret = 1;
  while (y > 0) {
    if (y & 1) {
      ret = ret * x % mod;
    }
    x = x * x % mod;
    y >>= 1;
  }
  return ret;
}

/**
 * (a / b) % mod
 * @param a
 * @param b
 * @param mod
 */
long long div_mod(long long a, long long b, long long mod) {
  return a * mod_pow(b, mod - 2, mod) % mod;
}

/**
 * n の約数
 * @param n
 */
vector<long long> get_divisors(long long n) {
  vector<long long> ret;
  long long rt = (long long) sqrt(n) + 1;
  for (long long i = 1; i < rt; ++i) {
    if (n % i == 0) {
      ret.push_back(i);
      if (n / i != i) {
        ret.push_back(n / i);
      }
    }
  }
  return ret;
}

/**
 * 0 から max までの逆元
 * @param max
 * @param mod
 * @return
 */
vector<long long> mod_invs(long long max, long long mod) {
  vector<long long> invs(max + 1, 1);
  for (long long x = 2; x <= max; ++x) {
    invs[x] = (-(mod / x) * invs[mod % x]) % mod;
  }
  return invs;
}

/**
 * 階乗 0!, 1!, 2!, ..., max! の逆元
 * @param max
 * @param mod
 * @return
 */
vector<long long> factorial_invs(long long max, long long mod) {
  vector<long long> ret;
  long long r = 1;
  for (const auto &inv : mod_invs(max, mod)) {
    r = r * inv % mod;
    ret.push_back(r);
  }
  return ret;
}

int main() {
  cout << fixed << setprecision(10);
//  cin.tie(nullptr);
//  ios::sync_with_stdio(false);
  ifstream ifs;
  if (DEBUG) {
    ifs.open("src/_in.txt");
    cin.rdbuf(ifs.rdbuf());
  }

  // 解説AC
  ll N;
  cin >> N;
  vector<ll> A;
  rep (i, N) {
    ll v0;
    cin >> v0;
    A.push_back(v0);
  }

  ll MAX1 = *max_element(all(A)) + 1;

  auto W = mod_invs(MAX1, MOD);
  repr (d, 1, MAX1) {
    W[d] = (W[d] % MOD + MOD) % MOD;
    reps (i, d * 2, MAX1, d) {
      W[i] -= W[d];
    }
  }

  vector<ll> counts(MAX1, 0);
  each (a, A) {
    counts[a] += 1;
  }

  vector<ml> P1(MAX1, 0);
  vector<ml> P2(MAX1, 0);
  repr (d, 1, MAX1){
    reps (a, d, MAX1, d) {
      P1[d] += a * counts[a];
      P2[d] += a * a * counts[a];
    }
  }

  ml ans = 0;
  repr (i, 1, MAX1) {
    ans += ((P1[i] * P1[i] - P2[i]) / 2) % MOD * W[i] % MOD;
    ans %= MOD;
  }
  cout << ans << "\n";
}


Measured memory_bytes: 80112