#include <bits/stdc++.h>
using namespace std;
const int maxN = 1000 + 5;
const int mod = 1000 * 1000 * 1000 + 7;
int a[65], b[65];
int main() {
  ios_base::sync_with_stdio(false);
  long long l, r;
  cin >> l >> r;
  for (int i = 0; l > 0; l /= 2, i++) a[i] = l % 2;
  for (int i = 0; r > 0; r /= 2, i++) b[i] = r % 2;
  int i;
  for (i = 60; i >= 0 && a[i] == b[i]; i--)
    ;
  if (i == -1)
    cout << 0 << endl;
  else
    cout << (1ll << (i + 1)) - 1 << endl;
  return 0;
}
