#include <bits/stdc++.h>
using namespace std;
using namespace std::chrono;
int f[64] = {0};
int g[64] = {0};
void solve() {
  long long int a, b;
  cin >> a >> b;
  int j = 0;
  while (a != 0) {
    f[j++] += a % 2;
    a /= 2;
  }
  j = 0;
  while (b != 0) {
    g[j++] += b % 2;
    b /= 2;
  }
  for (j = 63; j >= 0; j--) {
    if (f[j] == 0 && g[j] == 1) {
      cout << (long long int)(pow(2, j + 1) - 1);
      return;
    }
  }
  cout << 0;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout << fixed << setprecision(10);
  auto start = high_resolution_clock::now();
  int i, t = 1;
  for (i = 1; i <= t; i++) solve();
  auto stop = high_resolution_clock::now();
  auto duration = duration_cast<microseconds>(stop - start);
}
