def keta1 x, y
    answer = ((y - x + 1) / 2).odd? ? 1 : 0
    answer = 1 - answer if (y - x).even? && x.odd? 
    return answer
end

def getresidual x, y
    arr = [[], []]
    [x, y].each_with_index{|z, i|
        d = 4
        while true
            arr[i] << z % d
            d *= 2
            break if d > z * 2
        end
    }
    return arr
end

x, y = gets.chomp.split.map(&:to_i)
if x == y
    puts x
else
    answers = [keta1(x, y)]
    residuals = getresidual(x, y)

    d = 1
    residuals[1].length.times{|i|
        d *= 2
        if residuals[0][i].nil? || residuals[0][i] < d
            if residuals[1][i] < d
                answers << 0
            else
                answers << (residuals[1][i].even? ? 1 : 0)
            end
        else
            if residuals[1][i] < d
                answers << (residuals[0][i].even? ? 0 : 1)
            else
                answers << ((residuals[0][i] % 2 == residuals[1][i] % 2) ? 1 : 0)
            end
        end
    }
    puts answers.reverse.join.to_i(2)
end