program main
  implicit none
  integer(8) :: a, b

  read (*, *) a, b

  print "(i0)", ieor(xor_sum_0_n(a - 1), xor_sum_0_n(b))

  contains

  function xor_sum_0_n(n) result(res)
    integer(8), intent(in) :: n
    integer(8) :: res, i, d, k, q, m
    res = 0
    do d = 0, 60
      k = 2 ** d
      q = (n + 1) / (2 * k)
      m = modulo(n + 1, 2 * k)
      i = modulo(q * k + max(m - k, 0_8), 2_8)
      res = ieor(res, k * i)
    end do
  end function xor_sum_0_n
end program main
