#include <bits/stdc++.h>
using namespace std;
const long long mod = 1e9 + 7;
const long long maxn = 1e5 + 6;
const long long N = 1e2 + 2;
const long long inf = 1e12;
const long double eps = 1e-6;
using namespace std;
int main() {
  long long n, m, a, ans;
  cin >> n >> m;
  if (n == m) {
    cout << 0 << endl;
    return 0;
  }
  a = n ^ m;
  a = 64 - __builtin_clzll(a);
  ans = (1LL << a) - 1;
  cout << ans << endl;
  return 0;
}
