#include using namespace std; const int N = 1000010; const int P = 998244353; using u64 = unsigned long long; int n, dp, a[N], minp[N], cnt[N], sum[N]; inline void init(void) { std::vector P; for (int i = 2; i < N; i++) { if (minp[i] == 0) { P.push_back(i); minp[i] = i, cnt[i] = 1; } for (auto &p : P) { if (i * p >= N) break; minp[i * p] = p; if (i % p == 0) { cnt[i * p] = cnt[i]; break; } else { cnt[i * p] = cnt[i] + 1; } } } } std::vector comp(int x) { std::vector fac; fac.reserve(cnt[x]); while (x > 1) { int cur = minp[x]; fac.push_back(cur); while (x % cur == 0) x /= cur; } int m = fac.size(); std::vector ret(1 << m, 1); for (int S = 1; S < (1 << m); S++) { const int hb = std::__lg(S); ret[S] = ret[S ^ (1 << hb)] * fac[hb]; } return ret; } inline void optimizeIO(void) { ios::sync_with_stdio(false); cin.tie(NULL), cout.tie(NULL); } inline int sgn(int x) { return x & 1 ? 1 : P - 1; } int main(int argc, char const *argv[]) { optimizeIO(), cin >> n, init(), dp = 1; for (int i = 1; i <= n; i++) cin >> a[i]; for (auto &x : comp(a[1])) sum[x] = 1; for (int i = 2; i <= n; i++) { dp = 0; auto res = comp(a[i]); for (size_t S = 1; S < res.size(); S++) { int p = __builtin_popcount(S); dp = (dp + 1ll * sgn(p) * sum[res[S]]) % P; } for (auto &x : res) { sum[x] += dp; if (sum[x] >= P) sum[x] -= P; } } cout << dp << endl; return 0; }