mod = 998244353 n = int(input()) A = list(map(int,input().split())) x = 0 for a in A: x ^= a t = sum(A) for a in A: if x^a < a: t -= a-(x^a) break if x: t += 1 ans = (1-pow(pow(-3,mod-2,mod),t,mod))*(mod+1)//2%mod print(ans)