import sys,random,bisect from collections import deque,defaultdict,Counter from heapq import heapify,heappop,heappush from itertools import cycle, permutations from math import log,gcd input = lambda :sys.stdin.readline().rstrip() mi = lambda :map(int,input().split()) li = lambda :list(mi()) N = int(input()) A = li() res = 1 check = [0] * 30 def calc(_A,n): if n==-1: return X = [a for a in _A if a>>n & 1] Y = [a for a in _A if a>>n & 1 == 0] if X and Y: check[n] = 1 if n!=0: if X: calc(X,n-1) if Y: calc(Y,n-1) calc(A,29) for i in range(30): if check[i]: res *= 2 print(res)