A,B = list(map(int,input().split()))

i_num=100

def get_one(N,i_num=i_num):
    n_list=[0]*i_num

    for i in range(i_num):
        N_ = N
        if 2**i > N_:
            break
        if (N_//2**i) % 2 == 0:
            N_ = (2**i)*(N//2**i)-1

        n_list[i] = (((N_//(2**i))-1)//2)*2**i + N_%(2**i)+1
    return(n_list)

B_=get_one(B)
A_=get_one(A-1)

ans_ = [0]*i_num
for i in range(i_num):
    if (B_[i] - A_[i]) % 2 != 0:
        ans_[i] = 1
        
ans_.reverse()
ans=''.join(map(str,ans_))

print(int(ans,2)) A,B = list(map(int,input().split())) A list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split B i_num=100 i_num 100 def get_one(N,i_num=i_num):
    n_list=[0]*i_num

    for i in range(i_num):
        N_ = N
        if 2**i > N_:
            break
        if (N_//2**i) % 2 == 0:
            N_ = (2**i)*(N//2**i)-1

        n_list[i] = (((N_//(2**i))-1)//2)*2**i + N_%(2**i)+1
    return(n_list) get_one n_list=[0]*i_num n_list [0]*i_num [0] 0 i_num for i in range(i_num):
        N_ = N
        if 2**i > N_:
            break
        if (N_//2**i) % 2 == 0:
            N_ = (2**i)*(N//2**i)-1

        n_list[i] = (((N_//(2**i))-1)//2)*2**i + N_%(2**i)+1
     i range(i_num) range i_num N_ = N N_ N if 2**i > N_:
            break
         2**i > N_ 2**i 2 i N_ break if (N_//2**i) % 2 == 0:
            N_ = (2**i)*(N//2**i)-1

         (N_//2**i) % 2 == 0 (N_//2**i) % 2 N_//2**i N_ 2**i 2 i 2 0 N_ = (2**i)*(N//2**i)-1 N_ (2**i)*(N//2**i)-1 (2**i)*(N//2**i) 2**i 2 i N//2**i N 2**i 2 i 1 n_list[i] = (((N_//(2**i))-1)//2)*2**i + N_%(2**i)+1 n_list[i] n_list i (((N_//(2**i))-1)//2)*2**i + N_%(2**i)+1 (((N_//(2**i))-1)//2)*2**i + N_%(2**i) (((N_//(2**i))-1)//2)*2**i ((N_//(2**i))-1)//2 (N_//(2**i))-1 N_//(2**i) N_ 2**i 2 i 1 2 2**i 2 i N_%(2**i) N_ 2**i 2 i 1 return(n_list) n_list N N i_num=i_num i_num i_num B_=get_one(B) B_ get_one(B) get_one B A_=get_one(A-1) A_ get_one(A-1) get_one A-1 A 1 ans_ = [0]*i_num ans_ [0]*i_num [0] 0 i_num for i in range(i_num):
    if (B_[i] - A_[i]) % 2 != 0:
        ans_[i] = 1
         i range(i_num) range i_num if (B_[i] - A_[i]) % 2 != 0:
        ans_[i] = 1
         (B_[i] - A_[i]) % 2 != 0 (B_[i] - A_[i]) % 2 B_[i] - A_[i] B_[i] B_ i A_[i] A_ i 2 0 ans_[i] = 1 ans_[i] ans_ i 1 ans_.reverse() ans_.reverse ans_ reverse ans=''.join(map(str,ans_)) ans ''.join(map(str,ans_)) ''.join '' join map(str,ans_) map str ans_ print(int(ans,2)) print int(ans,2) int ans 2 i_num=100 100 i_num A,B = list(map(int,input().split())) list(map(int,input().split())) A ans_ = [0]*i_num [0]*i_num ans_ ans=''.join(map(str,ans_)) ''.join(map(str,ans_)) ans B_=get_one(B) get_one(B) B_ def get_one(N,i_num=i_num):
    n_list=[0]*i_num

    for i in range(i_num):
        N_ = N
        if 2**i > N_:
            break
        if (N_//2**i) % 2 == 0:
            N_ = (2**i)*(N//2**i)-1

        n_list[i] = (((N_//(2**i))-1)//2)*2**i + N_%(2**i)+1
    return(n_list) def get_one(N,i_num=i_num):
    n_list=[0]*i_num

    for i in range(i_num):
        N_ = N
        if 2**i > N_:
            break
        if (N_//2**i) % 2 == 0:
            N_ = (2**i)*(N//2**i)-1

        n_list[i] = (((N_//(2**i))-1)//2)*2**i + N_%(2**i)+1
    return(n_list) get_one B = list(map(int,input().split())) list(map(int,input().split())) B A_=get_one(A-1) get_one(A-1) A_
A,B = list(map(int,input().split()))

i_num=100

def get_one(N,i_num=i_num):
    n_list=[0]*i_num

    for i in range(i_num):
        N_ = N
        if 2**i > N_:
            break
        if (N_//2**i) % 2 == 0:
            N_ = (2**i)*(N//2**i)-1

        n_list[i] = (((N_//(2**i))-1)//2)*2**i + N_%(2**i)+1
    return(n_list)

B_=get_one(B)
A_=get_one(A-1)

ans_ = [0]*i_num
for i in range(i_num):
    if (B_[i] - A_[i]) % 2 != 0:
        ans_[i] = 1
        
ans_.reverse()
ans=''.join(map(str,ans_))

print(int(ans,2))