#include <bits/stdc++.h>
using namespace std;
typedef long long arr[100];
long long l, r;
arr a, b;
void chuyen(long long n, arr a) {
  int sl = 0;
  while (n) {
    a[++sl] = n % 2;
    n /= 2;
  }
}
int main() {
  ios::sync_with_stdio(false);
  cin >> l >> r;
  int u = int(log2(double(l))) + 1;
  int v = int(log2(double(r))) + 1;
  if (u < v) {
    long long kp = 0;
    long long d = 1;
    for (int i = 1; i <= v; i++) {
      kp += d;
      d *= 2;
    }
    cout << kp;
  } else {
    chuyen(l, a);
    chuyen(r, b);
    while (a[v] == b[v]) --v;
    long long kp = 0;
    long long d = 1;
    for (int i = 1; i <= v; i++) {
      kp += d;
      d *= 2;
    }
    cout << kp;
  }
}
