object Main {

  def main(args: Array[String]): Unit = {
    val sc = new java.util.Scanner(System.in)

    val _A, B = sc.nextLong()
    val A = _A - 1
    val POW = (0 until 40) map { i =>
      Math.pow(2, i).toLong
    }
    val R = new Array[Long](40)
    val N = Vector.fill(40)(0)

    var i = 0
    while (i < 40) {
      val NN = java.lang.Long.parseLong(N.updated(40 - i - 1, 1).mkString(""), 2)
      val a =
        if (A >= NN)
          ((A + 1) / POW(i) / 2 * POW(i)) + Math.max(((A + 1) % (2 * POW(i))) - POW(i), 0)
        else 0
      val b =
        if (B >= NN)
          ((B + 1) / POW(i) / 2 * POW(i)) + Math.max(((B + 1) % (2 * POW(i))) - POW(i), 0)
        else 0
      R(40 - i - 1) = (b - a) % 2L
      i += 1
    }
    println(java.lang.Long.parseLong(R.mkString(""), 2))
  }

}