#include <bits/stdc++.h>
using namespace std;
long long LLMAX = 9223372036854775807LL;
const int maxn = 1000 + 10;
long long l, r;
long long p[64];
int main() {
  p[0] = 1;
  for (int i = 1; i < 62; ++i) p[i] = p[i - 1] * (long long)2;
  cin >> l >> r;
  int i;
  for (i = 62; i >= 0; --i)
    if (l >= p[i] && r >= p[i])
      l -= p[i], r -= p[i];
    else if (r >= p[i] && l < p[i])
      break;
  if (l == r)
    puts("0");
  else
    cout << p[i + 1] - 1 << endl;
}
