p = 998244353 N = int(input()) A = list(map(int,input().split())) A.insert(0,0) if N==1: ans = A[1]%p else: a = 1 i = 0 while i