program main
  integer(8) :: A,B
  integer(8) :: out
  integer(8) :: N
  integer(8) :: i
  integer :: ibit
  read(*,*) A,B
  ! gtet B bit
  do i = 64,1,-1
     if ( btest(B,i) ) THEn
        ibit = i
        exit
     end if
  end do
  out=IBSET(A,ibit)
  out=out-1
  if (out > B) then
     out = IBSET(A,ibit-1)
     A=out
     N=B-out
     out=2**( ibit -1)
  else
     A=out
     N=B-out
     out=2**ibit
  end if
  do i = 1,N
     out = IEOR(out,A+i)
  end do
  write(*,'(i0)') out
!  write(*,'(i0)')

end program main