#include <bits/stdc++.h>
using namespace std;
int main() {
  long long b = 1LL;
  int pos = 0;
  long long ret = 0;
  long long l, r;
  cin >> l >> r;
  long long dif = r - l;
  while (dif >= b) {
    ret += b;
    b *= 2LL;
    pos++;
  }
  while (r >= b) {
    if (((l >> pos) ^ (r >> pos)) & 1LL == 1LL) ret += b;
    b *= 2LL;
    pos++;
  }
  cout << ret << endl;
  return 0;
}
