#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 1, i;
  long long n, m, mx, mn, k = 0, ans = 0;
  while (t--) {
    cin >> n >> m;
    for (int i = 63; i >= 0; i--) {
      int a = (m >> i) & 1, b = (n >> i) & 1;
      if (a != b && !k) k = 1;
      if (k) ans = ans | (1LL << i);
    }
    cout << ans;
  }
}
