const val MOD: Long = (1e9+7).toLong()

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

    if (a%2 == 1L) {
        if (b%2 == 0L) {
            val x = (((b-1)-(a+1)+1)/2)%2
            println((a xor b) xor x)
        } else {
            val x = ((b-(a+1)+1)/2)%2
            println(a xor x)
        }
    } else {
        if (b%2 == 0L) {
            val x = (((b-1)-a+1)/2)%2
            println(b xor x)
        } else {
            val x = ((b-a+1)/2)%2
            println(x)
        }
    }
}
