#include <bits/stdc++.h>
using namespace std;
string decToBinary(long long n) {
  string str;
  for (long long i = 63; i >= 0; i--) {
    long long k = n >> i;
    if (k & 1)
      str += "1";
    else
      str += "0";
  }
  return str;
}
int main() {
  long long a, b;
  cin >> a >> b;
  string strA, strB;
  if (a == 1 && b == 1) {
    cout << 0 << endl;
    return 0;
  }
  strA = decToBinary(a);
  strB = decToBinary(b);
  while (strA[0] != '1') {
    strA.erase(strA.begin() + 0);
  }
  while (strB[0] != '1') {
    strB.erase(strB.begin() + 0);
  }
  int i = 0;
  if (strA.size() == strB.size()) {
    while (strA[i] == strB[i]) {
      i++;
    }
  }
  long long res = pow(2LL, max(strA.size(), strB.size()) - i) - 1;
  cout << res << endl;
}
