A,B=gets.split.map(&:to_i)
def dat(n)
    n+=1
    lev=60
    ret=Array.new(lev,0)
    lev.times do |i|
        a = (n / (1<<(i+1)))*(1<<i)
        b=0
        b = (n % (1<<(i+1)))-(1<<i) if (1<<i)<=(n % (1<<(i+1)))
        ret[i]=a+b
    end
    return ret
end
as=dat(A-1)
bs=dat(B)
lev=60
ans=0
lev.times do |i|
    ans+=1<<i if (bs[i]-as[i]).odd?
end
puts ans

