let (a, b) = Scanf.sscanf (read_line ()) "%d %d" @@ fun a b -> (a, b)

let xor_sum = function
  | 0 | -1 -> 0
  | n -> let t = ((n + 1) / 2) mod 2 in if n mod 2 = 1 then t else t lxor n

let () = Printf.printf "%d\n" @@ ((xor_sum b) lxor (xor_sum (a - 1)))