#include <bits/stdc++.h>
using namespace std;
const int SIZE = 1e5 + 10;
const double eps = 1e-5;
const int INF = 0x3f3f3f3f;
const long long mod = 1e9 + 7;
long long a, b;
vector<int> p, q;
int main() {
  scanf("%lld%lld", &a, &b);
  while (a) {
    p.push_back(a & 1);
    a >>= 1;
  }
  while (b) {
    q.push_back(b & 1);
    b >>= 1;
  }
  while (p.size() < q.size()) p.push_back(0);
  long long ans = 0;
  for (int i = (int)p.size() - 1; i >= 0; i--) {
    if (!ans && p[i] == q[i]) continue;
    ans |= (1LL << i);
  }
  printf("%lld", ans);
  return 0;
}
