#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int l, r;
  cin >> l >> r;
  int le[64] = {0};
  int ri[64] = {0};
  int i = 0;
  if (l == r) {
    cout << "0";
    return 0;
  }
  for (i; l >= 2; i++) {
    le[i] = l % 2;
    l /= 2;
  }
  le[i] = l;
  i = 0;
  for (i; r >= 2; i++) {
    ri[i] = r % 2;
    r /= 2;
  }
  ri[i] = r;
  int z;
  for (int i = 63; i >= 0; i--) {
    if (le[i] != ri[i]) {
      z = i;
      break;
    }
  }
  long long int ans = pow(2, z + 1) - 1;
  cout << ans;
  return 0;
}
