def f(x):
  res=0
  cnt_xor=0
  cnt_xor=(x+2-1)//2
  if x%2==0:
    if cnt_xor%2==1:
      res=1^x
    else:
      res=0^x
  else:
    if cnt_xor%2==1:
      res=1
    else:
      res=0
  return res
a,b=map(int,input().split())
print(f(b)^f(a-1)) def f(x):
  res=0
  cnt_xor=0
  cnt_xor=(x+2-1)//2
  if x%2==0:
    if cnt_xor%2==1:
      res=1^x
    else:
      res=0^x
  else:
    if cnt_xor%2==1:
      res=1
    else:
      res=0
  return res f res=0 res 0 cnt_xor=0 cnt_xor 0 cnt_xor=(x+2-1)//2 cnt_xor (x+2-1)//2 x+2-1 x+2 x 2 1 2 if x%2==0:
    if cnt_xor%2==1:
      res=1^x
    else:
      res=0^x
  else:
    if cnt_xor%2==1:
      res=1
    else:
      res=0
   x%2==0 x%2 x 2 0 if cnt_xor%2==1:
      res=1^x
    else:
      res=0^x
   cnt_xor%2==1 cnt_xor%2 cnt_xor 2 1 res=1^x res 1^x 1 x res=0^x res 0^x 0 x if cnt_xor%2==1:
      res=1
    else:
      res=0
   cnt_xor%2==1 cnt_xor%2 cnt_xor 2 1 res=1 res 1 res=0 res 0 return res res x x a,b=map(int,input().split()) a map(int,input().split()) map int input().split() ().split () input split b print(f(b)^f(a-1)) print f(b)^f(a-1) f(b) f b f(a-1) f a-1 a 1 a,b=map(int,input().split()) map(int,input().split()) a def f(x):
  res=0
  cnt_xor=0
  cnt_xor=(x+2-1)//2
  if x%2==0:
    if cnt_xor%2==1:
      res=1^x
    else:
      res=0^x
  else:
    if cnt_xor%2==1:
      res=1
    else:
      res=0
  return res def f(x):
  res=0
  cnt_xor=0
  cnt_xor=(x+2-1)//2
  if x%2==0:
    if cnt_xor%2==1:
      res=1^x
    else:
      res=0^x
  else:
    if cnt_xor%2==1:
      res=1
    else:
      res=0
  return res f b=map(int,input().split()) map(int,input().split()) b
def f(x):
  res=0
  cnt_xor=0
  cnt_xor=(x+2-1)//2
  if x%2==0:
    if cnt_xor%2==1:
      res=1^x
    else:
      res=0^x
  else:
    if cnt_xor%2==1:
      res=1
    else:
      res=0
  return res
a,b=map(int,input().split())
print(f(b)^f(a-1))
