#include <bits/stdc++.h>
using namespace std;
int num[1000002];
int arr[1000000];
int in[1000000];
int main() {
  long long int a, b;
  cin >> a >> b;
  vector<int> t, t1;
  while (a || b) {
    t.push_back(a % 2);
    t1.push_back(b % 2);
    a /= 2, b /= 2;
  }
  int gemy, i;
  for (i = t.size() - 1; i >= 0; i--)
    if (t[i] != t1[i]) break;
  long long int out;
  out = pow(2, ++i) - 1;
  cout << out;
}
