from math import gcd def isprime(n): if n <= 1: return False elif n == 2: return True elif n % 2 == 0: return False A = [2, 325, 9375, 28178, 450775, 9780504, 1795265022] s = 0 d = n - 1 while d % 2 == 0: s += 1 d >>= 1 for a in A: if a % n == 0: return True x = pow(a, d, n) if x != 1: for t in range(s): if x == n - 1: break x = x * x % n else: return False return True def pollard(n): if n % 2 == 0: return 2 if isprime(n): return n f = lambda x:(x * x + 1) % n step = 0 while 1: step += 1 x = step y = f(x) while 1: p = gcd(y - x + n, n) if p == 0 or p == n: break if p != 1: return p x = f(x) y = f(f(y)) def primefact(n): if n == 1: return [] p = pollard(n) if p == n: return [p] left = primefact(p) right = primefact(n // p) left += right return sorted(left) def popcount(n): n = (n & 0x5555555555555555) + ((n >> 1) & 0x5555555555555555) n = (n & 0x3333333333333333) + ((n >> 2) & 0x3333333333333333) n = (n & 0x0f0f0f0f0f0f0f0f) + ((n >> 4) & 0x0f0f0f0f0f0f0f0f) n = (n & 0x00ff00ff00ff00ff) + ((n >> 8) & 0x00ff00ff00ff00ff) n = (n & 0x0000ffff0000ffff) + ((n >> 16) & 0x0000ffff0000ffff) n = (n & 0x00000000ffffffff) + ((n >> 32) & 0x00000000ffffffff) return n MOD = 998244353 n = int(input()) A = list(map(int, input().split())) ans = 0 dp = [0] * (10 ** 6 + 1) for a in A: lst = list(set(primefact(a))) l = len(lst) tot = 1 for bit in range(1, 1 << l): prod = 1 pm = -1 for i in range(l): if bit >> i & 1: prod *= lst[i] tot += dp[prod] tot %= MOD ans += tot ans %= MOD for bit in range(1, 1 << l): prod = 1 pm = -1 for i in range(l): if bit >> i & 1: pm *= -1 prod *= lst[i] dp[prod] += pm * tot dp[prod] %= MOD print(ans % MOD)