(* O(1) *)
let f1 n = if n mod 2 = 0 then 0 else 1

(* O(1) *)
let solve a b =
  let first, d1 = if a mod 2 = 0 then 0, 0 else a, 1 in
  let last, d2 = if b mod 2 = 0 then b, 1 else 0, 0 in
  first lxor last lxor f1 ((b - a + 1 - d1 - d2) / 2)

let read_ints () = read_line () |> Str.split (Str.regexp " ") |> List.map int_of_string

let _ =
  match read_ints () with
  | [a; b] -> solve a b |> string_of_int |> print_endline
  | _ -> ()