MOD = 998244353 def main(): import sys input = sys.stdin.read().split() N = int(input[0]) A = list(map(int, input[1:N+1])) current_groups = [A] ans = 1 for bit in reversed(range(30)): # from 29 down to 0 new_groups = [] for group in current_groups: mask = 1 << bit left = [] right = [] for x in group: if (x & mask) == 0: left.append(x) else: right.append(x) if len(left) > 0 and len(right) > 0: ans = (ans * 2) % MOD if left: new_groups.append(left) if right: new_groups.append(right) current_groups = new_groups print(ans % MOD) if __name__ == "__main__": main()