#include <bits/stdc++.h>
using namespace std;
void cp() {
  ios ::sync_with_stdio(false);
  cin.tie(0);
  cout.tie(0);
}
long long power(long long x, long long y) {
  long long res = 1;
  while (y > 0) {
    if (y & 1) res = res * x;
    y = y >> 1;
    x = x * x;
  }
  return res;
}
int main() {
  cp();
  {
    long long a;
    cin >> a;
    ;
    long long b;
    cin >> b;
    ;
    if (a == b)
      cout << "0";
    else {
      long long y = log2(a ^ b) + 1;
      cout << power(2, y) - 1;
    }
  }
  cerr << "Time : " << 1000 * ((double)clock()) / (double)CLOCKS_PER_SEC
       << "ms\n";
}
