fun main(args: Array<String>) {
    val (a, b) = readLine()!!.split(' ').map { it.toLong() }

    var ans = 0L
    var x = 2L
    var l = b
    while (l > 0) {
        l = l shr 1

        val ac = f(a - 1, x)
        val bc = f(b, x)

        ans += if ((bc - ac) % 2 == 1L) x shr 1 else 0L

        x = x shl 1
    }
    println(ans)
}

private fun f(x: Long, y: Long): Long {
    return (x + 1) / y * (y shr 1) + Math.max(0L, (x + 1) % y - (y shr 1))
}
