N = int(input()) A = list(map(int, input().split())) MOD = 998244353 A.sort() state = [(0, N-1)] ans = 1 for i in range(29, -1, -1): res = 1 nstate = [] for l, r in state: if (A[l] >> i) & 1 == (A[r] >> i) & 1: nstate.append((l, r)) continue res = 2 mid = 0 for j in range(l, r): if (A[j] >> i) & 1 < (A[j+1] >> i) & 1: mid = j nstate.append((l, mid)) nstate.append((mid+1, r)) break state = nstate ans *= res print(ans % MOD)