fun main(args: Array<String>) {
    val (a,b) = readLine()!!.split(" ").mapIndexed{ s ,i-> s.toLong()+i.toLong()-1 }
        .map{num->
            Array(62){i->
                2.toLong() shl i}.map{i->
                ((num-num%i)/2 + Math.max(num%i+1-i/2,0))%2
            }
        }
    var result:Long = 0
    for(i in 61 downTo  0) {
        if(a[i] != b[i]){
            result+= (1.toLong() shl i)
        }
    }
    println(result)
}