#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int l, r, x1, x2, i, j, sum1 = 0, ans = 1;
  vector<long long int> v1;
  vector<long long int> v2;
  vector<long long int> v3;
  cin >> l >> r;
  x1 = l;
  x2 = r;
  while (x1 != 0) {
    v1.push_back(x1 % 2);
    x1 = x1 / 2;
  }
  while (x2 != 0) {
    v2.push_back(x2 % 2);
    x2 = x2 / 2;
  }
  if (v1.size() == v2.size()) {
    for (i = v1.size() - 1; i >= 0; i--) {
      if (v1[i] == v2[i])
        v3.push_back(0);
      else {
        v3.push_back(1);
        break;
      }
    }
    for (j = i - 1; j >= 0; j--) v3.push_back(1);
    sum1 = 0;
    ans = 1;
    for (j = v3.size() - 1; j >= 0; j--) {
      sum1 = sum1 + (v3[j] * ans);
      ans = ans * 2;
    }
    cout << sum1 << endl;
  } else {
    for (j = 0; j < v2.size(); j++) v3.push_back(1);
    sum1 = 0;
    ans = 1;
    for (j = 0; j < v3.size(); j++) {
      sum1 = sum1 + (v3[j] * ans);
      ans = ans * 2;
    }
    cout << sum1 << endl;
  }
  return 0;
}
