mod = 998244353 def rec(arr, d): if d < 0: return 1 one = [] zero = [] for a in arr: if (a >> d) & 1: one.append(a) else: zero.append(a) if not one: return rec(zero, d - 1) if not zero: return rec(one, d - 1) return 2 * rec(zero, d - 1) * rec(one, d - 1) % mod N = int(input()) A = list(map(int, input().split())) print(rec(A, 32))