MOD = 998244353 n = int(input()) a = list(map(int, input().split())) from collections import deque d = 0 q = deque() q.append(a) while q: current = q.popleft() if len(current) <= 1: continue or_val = 0 and_val = (1 << 30) - 1 # Initialize with all bits set for num in current: or_val |= num and_val &= num mask = or_val ^ and_val if mask == 0: continue highest_bit = mask.bit_length() - 1 d += 1 group0 = [] group1 = [] for num in current: if (num >> highest_bit) & 1: group1.append(num) else: group0.append(num) if group0: q.append(group0) if group1: q.append(group1) ans = pow(2, d, MOD) print(ans)