open Printf open Scanf
open Array

let calc c =
  init 40 (fun i ->
    let pw = 1 lsl i in
    let pairs = (c+1) / 2 / pw in
    let left = c+1 - pairs * 2 * pw in
    (if i=0 then pairs mod 2 else 0) lxor (if left > pw then (left-pw) mod 2 else 0)
  )
  |> mapi (fun i v -> i,v)
  |> fold_left (fun sum (i,v) -> sum + v * 1 lsl i) 0

let () = scanf " %d %d" @@ fun a b ->
  print_int @@ (calc b) lxor (calc (a-1))


