MOD = 998244353 n = int(input()) a = list(map(int, input().split())) distinct = list(sorted(set(a))) if len(distinct) <= 1: print(1) else: current_groups = [distinct.copy()] answer = 1 for bit in reversed(range(30)): # Process from highest bit (29) to 0 can_split = False # Check if any group can be split at this bit for group in current_groups: if len(group) <= 1: continue first_bit = (group[0] >> bit) & 1 for num in group[1:]: if (num >> bit) & 1 != first_bit: can_split = True break if can_split: break if can_split: answer = (answer * 2) % MOD # Split all groups into subgroups based on current bit new_groups = [] for group in current_groups: subgroup0 = [] subgroup1 = [] for num in group: if (num >> bit) & 1 == 0: subgroup0.append(num) else: subgroup1.append(num) if subgroup0: new_groups.append(subgroup0) if subgroup1: new_groups.append(subgroup1) current_groups = new_groups print(answer)