fun xor(x: Long): Long {
    var xor = 0L
    for (i in 0 until java.lang.Long.toBinaryString(x).length) {
        val p = 1L shl i + 1
        val passert = p shr 1
        val sassert = (x + 1) / p * passert + Math.max((x + 1) % p - passert, 0)
        if (sassert and 1 == 1L) {
            xor += passert
        }
    }
    return xor
}

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