#include <bits/stdc++.h>
using namespace std;
long long a[1000010], b[1000010];
long long dp[110][110][15][2] = {0};
signed main() {
  ios::sync_with_stdio(0);
  long long a, b;
  cin >> a >> b;
  if (a == b)
    cout << 0;
  else {
    long long p = 60;
    while ((a >> p) == (b >> p) && ((a >> p) & 1) == 0 || ((a >> p) & 1) == 1)
      p--;
    cout << ((long long)1 << p + 1) - 1;
  }
  return 0;
}
