MOD = 998244353 N = int(input()) a = list(map(int, input().split())) a.sort() ls = [[0, N - 1]] ans = 1 for k in range(32, -1, -1): flag = 0 nls = [] for l, r in ls: if (a[l] >> k) & 1: nls.append([l, r]) elif (a[r] >> k) & 1 == 0: nls.append([l, r]) else: for i in range(l + 1, r + 1): if (a[i] >> k) & 1: flag = 1 if i - 1 > l: nls.append([l, i - 1]) if i < r: nls.append([i, r]) if flag: ans = (ans * 2) % MOD ls = nls print(ans)