n = int(input()) a = list(map(int,input().split())) mod = 998244353 def e(n): #O(NloglogN) l = [i for i in range(n+1)] l[0] = 0 l[1] = 1 for i in range(2,n): if l[i] == i: for p in range(i+i,n+1,i): l[p] = i return l l = e(10**6+10) now = [0]*(10**6+10) for ai in a[::-1]: s = set() aai = ai while aai != 1: s.add(l[aai]) aai //= l[aai] tmp = 0 cnt = 0 for i in s: tmp += now[i] tmp %= mod cnt += 1 now[ai] -= (cnt-1)*(tmp+1) now[ai] %= mod for i in s: now[i] += tmp+1 now[i] %= mod print(sum(now)%mod)