#include using namespace std; #include using namespace atcoder; using mint=modint998244353; //1000000007; using ll=long long; using pp=pair; #define sr string #define vc vector #define fi first #define se second #define rep(i,n) for(int i=0;i<(int)n;i++) #define pb push_back #define all(v) v.begin(),v.end() #define pque priority_queue #define bpc(a) __builtin_popcount(a) struct divs{ int n; vector f, primes; divs(int n=1):n(n), f(n+1) { f[0] = f[1] = -1; for (ll i = 2; i <= n; ++i) { if (f[i]) continue; primes.push_back(i); f[i] = i; for (ll j = i*i; j <= n; j += i) { if (!f[j]) f[j] = i; } } } bool isPrime(int x) { return f[x] == x;} vector factorList(int x) { vector res; while (x != 1) { res.push_back(f[x]); x /= f[x]; } return res; } vector> factor(int x) { vector fl = factorList(x); if (fl.size() == 0) return {}; vector> res(1, pair(fl[0], 0)); for (int p : fl) { if (res.back().first == p) { res.back().second++; } else { res.emplace_back(p, 1); } } return res; } vcmev(int x){ auto fl=factor(x); vcres; for(auto [a,z]:fl){ for(int i=res.size()-1;i>=0;i--)res.pb(res[i]*a); res.pb(a); } return res; } }; int main(){ int n;cin>>n; int m=1e6; vcv(n); rep(i,n)cin>>v[i]; mapmp; vcmv(m+1,-1); divs d(m); for(ll au:d.primes)for(ll i=au*au;i<=m;i+=au*au)mv[i]=0; for(auto au:d.primes)for(int i=au;i<=m;i+=au)mv[i]*=-1; mint ans=0; rep(i,n){ int a=v[i]; mint now=1; for(auto au:d.mev(a))now+=mv[au]*mp[au]; for(auto au:d.mev(a))mp[au]+=now; ans+=now; } cout<