#include <bits/stdc++.h>
using namespace std;
const int N = 2e5 + 50;
const long long M = 1e9 + 7;
long long gcd(long long a, long long b) { return !b ? a : gcd(b, a % b); }
long long lcm(long long a, long long b) { return (a / gcd(a, b)) * b; }
void solve() {
  long long a, b;
  scanf("%lld%lld", &a, &b);
  if (a == b) {
    puts("0");
    return;
  }
  for (long long i = 63; i >= 0; --i) {
    if ((a & (1ll << i)) ^ (b & (1ll << i))) {
      printf("%lld", ((1ll << (i + 1)) - 1));
      return;
    }
  }
}
int main() {
  int t = 1;
  while (t--) solve();
}
