mod = 998244353 def main(): import sys input = sys.stdin.readline N = int(input()) A = [list(map(int, input().split()))] ans = 1 for i in range(31): flg = 0 A_new = [] for AA in A: seen = [0, 0] a0 = [] a1 = [] for a in AA: seen[a >> i & 1] = 1 if a >> i & 1: a1.append(a) else: a0.append(a) if seen[0] * seen[1]: flg = 1 if a0: A_new.append(a0) if a1: A_new.append(a1) if flg: ans = (ans * 2) % mod A = A_new print(ans) if __name__ == '__main__': main()