a,b = gets.chomp.split().map(&:to_i)

amount = b-a+1
ab = b.to_s(2)

ans = 0

# 桁ごとに
(ab.size).times do |digit|
  # 周期
  period = 2**(digit+1)

  # 周期の数
  pair_num = (amount/period)
  above = below = 0
  
  if pair_num*period!=amount

    # 周期外(上部)
    above = [[period-a+(a/period*period),period/2].min, 0].max

    # 周期外(下部)
    below = [b+1-b/period*period-period/2, 0].max

  end
  # 桁のbit計算して追加
  bit = (above + below)%2
  if digit==0

  ans += pair_num%2
  else
  ans += bit * (2**digit)
  end
end

puts ans

