#include <bits/stdc++.h>
using namespace std;
const long long N = 65, INF = 4e17;
bitset<N> a, b;
long long dp[N][2][2][2][2];
long long DP(int pos, int t1, int t2, int t3, int t4) {
  if (pos < 0) return 0;
  if (dp[pos][t1][t2][t3][t4] != -1) return dp[pos][t1][t2][t3][t4];
  long long ret = 0;
  int la = (t1 ? 0 : b[pos]), ra = (t2 ? 1 : a[pos]);
  int lb = (t3 ? 0 : b[pos]), rb = (t4 ? 1 : a[pos]);
  for (long long i = la; i <= ra; i++)
    for (long long j = lb; j <= rb; j++)
      ret = max(ret, ((i ^ j) << pos) +
                         DP(pos - 1, (t1 | (i > b[pos])), (t2 | (i < a[pos])),
                            (t3 | (j > b[pos])), (t4 | (j < a[pos]))));
  return dp[pos][t1][t2][t3][t4] = ret;
}
int main() {
  memset(dp, -1, sizeof dp);
  long long x, y;
  scanf("%lld %lld", &x, &y);
  b = x, a = y;
  printf("%lld\n", DP(N - 1, 0, 0, 0, 0));
  return 0;
}
