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