object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)
    val A, B = sc.nextLong
    val startA = if (A >= 4) ((A - 1) / 4) * 4 else 0
    val startB = if (B >= 4) (B / 4) * 4 else 0
    val zero = Array.fill[Char](B.toBinaryString.length)('0')
    val xorA = Array.fill[Char](B.toBinaryString.length)('0')
    for (i <- startA to A - 1) {
      val b = (zero ++ i.toBinaryString).takeRight(xorA.length)
      for (j <- xorA.length - 1 to 0 by -1) {
        xorA(j) = if (b(j) == xorA(j)) '0' else '1'
      }
    }
    val xorB = Array.fill[Char](B.toBinaryString.length)('0')
    for (i <- startB to B) {
      val b = (zero ++ i.toBinaryString).takeRight(xorA.length)
      for (j <- xorB.length - 1 to 0 by -1) {
        xorB(j) = if (b(j) == xorB(j)) '0' else '1'
      }
    }
    val resultXor = Array.fill[Char](B.toBinaryString.length)('0')
    for (i <- resultXor.indices) {
      resultXor(i) = if (xorA(i) == xorB(i)) '0' else '1'
    }
    var result = 0L
    for (i <- resultXor.indices) {
      if (resultXor(i) == '1')
        result += Math.pow(2, resultXor.length - i - 1).toLong
    }

    println(result)
  }
}