#include <bits/stdc++.h>
using namespace std;
long long bd(string n) {
  string num = n;
  long long dec_value = 0;
  long long base = 1;
  long long len = num.length();
  for (long long i = len - 1; i >= 0; i--) {
    if (num[i] == '1') dec_value += base;
    base = base * 2;
  }
  return dec_value;
}
long long db(long long n) {
  for (long long i = 31; i >= 0; i--) {
    long long k = n >> i;
    if (k & 1)
      cout << "1";
    else
      cout << "0";
  }
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long l, r;
  cin >> l >> r;
  if (l < r) {
    long long x = 64 - (__builtin_clzll(l ^ r));
    long long y = 1;
    long long ans = y << x;
    ans--;
    cout << ans;
  } else
    cout << 0;
  return 0;
}
