fun main(args : Array<String>) {
    val (A, B) = readLine()!!.split(" ").map { it.toLong() }
    var answer = 0L
    val enoughBigDigit = 100
    (1..enoughBigDigit).forEach { digit ->
        val sumA = sum(A - 1, digit)
        val sumB = sum(B, digit)
        answer += Math.abs(sumB - sumA) * Math.pow(2.toDouble(), (digit - 1).toDouble()).toLong()
    }
    println(answer)
}

fun sum(num: Long, digit: Int) : Int {
    if (num == -1L) {
        return 0
    }

    if (digit == 1) {
        if (num.mod(4) == 1L || num.mod(4) == 2L) {
            return 1
        } else {
            return 0
        }
    }

    val freq = Math.pow(2.toDouble(), digit.toDouble()).toLong()
    val mod = num.mod(freq)
    if (mod < freq / 2) {
        return 0
    }

    if ((mod - freq / 2).mod(2) == 0L) {
        return 1
    } else {
        return 0
    }
}