#include using namespace std; using ll = long long; #define rep(i,n) for (int i = 0; i < n; i++) #define rrep(i,n) for (int i = (n) - 1; i >= 0; i--) #define all(v) v.begin(),v.end() #define rall(v) v.rbegin(),v.rend() template bool chmax(T &a, T b){if (a < b){a = b;return true;} else return false;} template bool chmin(T &a, T b){if (a > b){a = b;return true;} else return false;} struct Eratosthenes{ vector prime; vector factor, mobius; Eratosthenes(int n) : prime(n + 1, true), factor(n + 1, -1), mobius(n + 1, 1){ prime[1] = false; factor[1] = 1; for (int p = 2; p <= n; p++){ if (!prime[p]){ continue; } factor[p] = p; mobius[p] = -1; for (int q = 2 * p; q <= n; q += p){ prime[q] = false; factor[q] = p; if ((q / p) % p == 0){ mobius[q] = 0; } else{ mobius[q] = -mobius[q]; } } } } vector> factorize(int n){ vector> pf; while (n > 1){ int p = factor[n], exp = 0; while (n % p == 0){ n /= p; exp++; } pf.push_back(make_pair(p, exp)); } return pf; } vector divisors(int n){ vector div = {1}; vector> pf = factorize(n); for (auto [p, e] : pf){ int l = div.size(); for (int i = 0; i < l; i++){ int q = p; for (int j = 0; j < e; j++){ div.push_back(div[i] * q); q *= p; } } } //sort(div.begin(), div.end()); return div; } int euler(int n){ int e = n; vector> pf = factorize(n); for (int i = 0; i < pf.size(); i++){ e /= pf[i].first; e *= pf[i].first - 1; } return e; } }; const int MOD = 998244353; int n, A[200010]; ll dp[1000010], S[100010]; int main(){ ios::sync_with_stdio(false); std::cin.tie(nullptr); cin >> n; ll s = 0; Eratosthenes er(1e6 + 1); rep(i, n){ cin >> A[i]; ll x = 1 + s; int a = 1; vector div = er.divisors(A[i]); for (auto a : div){ x -= er.mobius[a] * S[a]; x %= MOD; if (x < 0){ x += MOD; } } dp[A[i]] += x; dp[A[i]] %= MOD; s += x; s %= MOD; for (auto a : div){ S[a] += x; S[a] %= MOD; } } cout << s << "\n"; }