N=int(input()) D=list(map(int,input().split())) W=list(map(int,input().split())) # xorの掃き出し法・基底 BASE=[] def sweep(x): for b in BASE: if b^x