const main = (input) => {
  const inputs = input.trim().split('\n');
  const A = Number.parseInt(inputs[0].split(" ")[0]);
  const B = Number.parseInt(inputs[0].split(" ")[1]);
  var ans = "";
  var idx = 2;
  while(B>=idx/2){
    var a = idx-A%idx;
    var b = B%idx;
    var cl = 0;
    if(a>idx/2) cl = 0;
    else cl = a%2;
    if(b<idx/2) cl += 0;
    else cl += (b+1)%2;

    idx*=2;
    ans = (cl%2).toString() + ans;
  }

  console.log(parseInt(ans,2));
}

main(require('fs').readFileSync('/dev/stdin', 'UTF-8'));
