import java.lang.Long.max
import java.lang.Long.min
import java.util.ArrayDeque

//

fun main() {
    abc121d()
}

fun abc121d() {
    val (a, b) = readLine()!!.split(" ").map { it.toLong() }
    val from0toA = fromZeroToN(a - 1)
    val from0toB = fromZeroToN(b)
    println(from0toA.xor(from0toB))
}

private fun fromZeroToN(n: Long): Long {
    // n と n+1のxorは1になるので計算を省略できる
    if (n <= 0L) return 0L
    return if (n % 2 == 1L) {
        (n + 1) / 2 % 2
    } else {
        n.xor(n / 2 % 2)
    }
}
