#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, m, c, p, q, i, ans = 1, in;
  scanf("%lld %lld", &n, &m);
  c = 0;
  if (n == m)
    printf("0\n");
  else {
    while (n > 0 || m > 0) {
      p = n % 2;
      q = m % 2;
      if (p != q) in = c;
      c++;
      n = n / 2;
      m = m / 2;
    }
    for (i = 1; i <= in + 1; i++) ans = ans * 2;
    printf("%lld\n", ans - 1);
  }
  return 0;
}
