A , B = gets.split.map{|i| i.to_i}

if A % 2 == 0
    if A % 4 == 0
        x = 0
    else
        x = 1
    end
else
    if (A - 1) % 4 == 0
        x = A - 1
    else
        x = (A - 1) ^ 1
    end
end

if (B + 1) % 2 == 0
    if (B + 1) % 4 == 0
        y = 0
    else
        y = 1
    end
else
    if B % 4 == 0
        y = B
    else
        y = B ^ 1
    end
end

puts x ^ y