#include <bits/stdc++.h>
using namespace std;
bool a[64], b[64];
int main() {
  long long l, r, t = 1LL;
  int i = 0;
  scanf("%I64d%I64d", &l, &r);
  while (i < 64) {
    a[i] = (l & 1) == 1;
    b[i] = (r & 1) == 1;
    i++;
    l >>= 1;
    r >>= 1;
  }
  for (i = 63; i >= 0; i--) {
    if (a[i] != b[i]) break;
  }
  printf("%I64d\n", (1LL << (i + 1)) - 1LL);
}
