## https://yukicoder.me/problems/no/2075 MOD = 998244353 def main(): N = int(input()) A = list(map(int, input().split())) # osa-k法による素因数となる素数を列挙 max_a = max(A) if max_a == 1: print(N) return primes = [p for p in range(max_a + 1)] for p in range(2, max_a + 1): if primes[p] != p: continue x = 2 * p while x <= max_a: primes[x] = min(primes[x], p) x += p p_divisors = [] for i in range(N): a = A[i] p_list = [] while primes[a] != 1: if len(p_list) == 0 or p_list[-1] != primes[a]: p_list.append(primes[a]) a //= primes[a] p_d_len = len(p_list) array = [] for p_bit in range(1, 2 ** p_d_len): bit_count = 0 a = 1 for j in range(p_d_len): if p_bit & (1 << j) > 0: a *= p_list[j] bit_count += 1 array.append((a, bit_count)) p_divisors.append(array) # dpを使う primes_sum = [0] * (max_a + 1) answer = 0 for i in range(N): ans = 1 for a, bit_count in p_divisors[i]: ans += (primes_sum[a] * pow(-1, bit_count + 1, MOD)) % MOD ans %= MOD answer += ans answer %= MOD for a, _ in p_divisors[i]: primes_sum[a] += ans primes_sum[a] %= MOD print(answer) if __name__ == "__main__": main()