#include <bits/stdc++.h>
using namespace std;
long long n, m, k, a[100000], b[1000000], i, s, j, x, y;
int main() {
  cin >> n >> m;
  if (n == m) {
    cout << "0" << endl;
    return 0;
  }
  while (n > 0) {
    a[i] = n % 2;
    n = n / 2;
    i++;
  }
  while (m > 0) {
    b[x] = m % 2;
    m = m / 2;
    x++;
  }
  while (a[x] == b[x]) {
    x--;
  }
  y = 1;
  for (j = 0; j <= x; j++) {
    y *= 2;
  }
  cout << y - 1 << endl;
}
