fun main(args: Array<String>) {
    val (a, b) = readInputLine().split(" ").map{it.toLong()}
    
    if (a == 0L) {
        println(b)
        return
    }
    
    val aSum = f(a - 1L)
    val bSum = f(b)

    println(bSum xor aSum)
}

fun readInputLine(): String {
    return readLine()!!
}

fun f(x: Long): Long {
    if (x == 0L) {
        return 0L
    }
    
    if (x % 2L == 0L) {
        return x xor (1L * (x / 2L) % 2L)
    }
    
    return 1L * (x / 2L + 1) % 2L
}
