#include <bits/stdc++.h>
using namespace std;
int main() {
  long long a, b;
  while (cin >> a >> b) {
    int i;
    for (i = 62; i >= 0; i--) {
      if ((b & (1LL << i)) == (a & (1LL << i)))
        continue;
      else
        break;
    }
    cout << (1LL << (i + 1)) - 1 << endl;
  }
  return 0;
}
