#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int a1, a2;
  cin >> a1 >> a2;
  if (a1 == a2) {
    cout << 0;
    return 0;
  }
  int q1[100], q2[100];
  int q[100];
  for (int i = 0; i <= 99; i++) {
    q1[i] = a1 % 2;
    a1 /= 2;
    q2[i] = a2 % 2;
    a2 /= 2;
  }
  int s = 1;
  for (int i = 99; i >= 0; i--) {
    if (!s) {
      q[i] = 1;
    } else {
      if (q1[i] == q2[i]) {
        q[i] = 0;
      } else {
        q[i] = 1;
        s = 0;
      }
    }
  }
  long long int h = 1;
  long long int t = 0;
  for (int i = 0; i <= 99; i++) {
    t += q[i] * h;
    h *= 2;
  }
  cout << t;
}
