#include <bits/stdc++.h>
using namespace std;
long long power(long long a, long long b, long long m) {
  long long ans = 1;
  while (b) {
    if (b & 1) ans = (ans * a) % m;
    b /= 2;
    a = (a * a) % m;
  }
  return ans;
}
long long gcd(long long a, long long b) {
  if (a == 0) return b;
  return gcd(b % a, a);
}
long long lcm(long long a, long long b) { return (a * b) / gcd(a, b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long t = 1, b = 1;
  while (t--) {
    long long l, r;
    cin >> l >> r;
    long long x = l ^ r;
    if (l == r) {
      cout << 0 << "\n";
      continue;
    }
    long long y = floor(log2(x)) + 1;
    long long z = 1, ans = 0;
    while (y--) {
      z = z * 2;
    }
    cout << z - 1 << "\n";
  }
  return 0;
}
