#include<bits/stdc++.h>
using ll  = long long;
#define int ll
#define rep(i,n) for(int i=0;i<n;i++)
#define loop(i,s,n) for(int i=s;i<n;i++)
#define erep(e,v) for(auto && e :v)
#define all(in) in.begin(), in.end()
#define MP make_pair
#define INF (sizeof(int) == 4 ? (int)1e9:(int)1e18)
#define EPS 0.0000000001
using namespace std;
template<class T, class S> void cmin(T &a, const S &b) { if (a > b)a = b; }
template<class T, class S> void cmax(T &a, const S &b) { if (a < b)a = b; }
template<typename Head, typename Value> auto vectors(const Head &head, const Value &v) { return vector<Value>(head, v); }
template<typename Head, typename... Tail> auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector<decltype(inner)>(x, inner); }
template<class T> void join(T a){for(auto itr :a){if(itr != *a.begin())cout << " "; cout << itr;} }
using ld  = long double;
using pii = pair<int,int>;
using piii = pair<int,pii>;
int W,H;
int dx[]={0,0,1,-1}, dy[]={1,-1,0,0};
bool valid(int x,int y){return (0<=x&&x<W)&&(0<=y&&y<H);}
class dynamic_bitset {
private:
    long long bit;
    string sbit                = "";
    unsigned long long bitsize = 0;
    
public:
    dynamic_bitset(int _bit) : bit{_bit} {
        for (int t = 1, mask = 2; bitsize == 0; t++, mask *= 2) {
            if (mask - 1 >= bit) bitsize = t;
        }
        for (int i = 0; i < bitsize; i++) {
            sbit = ((bit >> i & 1) == 1 ? "1" : "0") + sbit;
        }
    }
    dynamic_bitset(int _bit, int bitrange) : bit{_bit} {
        for (int t = 1, mask = 2; bitsize == 0; t++, mask *= 2) {
            if (mask - 1 >= bit) bitsize = t;
        }
        for (int i = 0; i < bitrange; i++) {
            sbit = (i < bitsize and ((bit >> i & 1) == 1) ? "1" : "0") + sbit;
        }
    }
    auto test(int _idx) {
        assert(_idx < sbit.size() && "excution will be out of range");
        return sbit[_idx] == '1';
    }
    void set(int _idx) {
        assert(_idx < sbit.size() && "excution will be out of range");
        sbit[_idx] = '1';
    }
    auto size() { return sbit.size(); }
    bool isAll() {
        return accumulate(sbit.begin(), sbit.end(), true,
                          [](bool r, char c) { return r && c == '1'; });
    }
    bool none() {
        return accumulate(sbit.begin(), sbit.end(), true,
                          [](bool r, char c) { return r && c == '0'; });
    }
    auto to_string() {return sbit; }
};
signed main(){
    int a,b;
    cin >> a >> b;
    if(a == b){return cout << a << endl,0;}
    map<int,int>amp,bmp;
//    for(; num <=a; num*=2){
//        int ta = a + 1;
//        amp[cnt++] = ta / num * num/2 + max(0LL,ta % num - num/2 );
//    }
    for(int i = 0; (1LL << i) <= a-1;++i){
        int range = (1LL << (i+1));
        int ta = a;
        amp[i] = (ta / range * (range/2)) + max(0LL,ta % range - range/2);
    }
    for(int i = 0; (1LL << i) <= b;++i){
        int range = (1LL << (i+1));
        int tb = b+1;
        bmp[i] = (tb / range * (range/2)) + max(0LL,tb % range - range/2);
    }
    int ans = 0;
    for(int i = 0; (1LL << i) <= b; i++){
        int bit = bmp[i] - amp[i];
        assert(bit >= 0);
        if(bit%2 and bit > 0){
            ans += (1LL << (i));
            
        }
     }
    cout << ans << endl;
//    for(auto itr : amp){
//        cout << itr.first << " " << itr.second << endl;
//    }
//    for(auto itr : bmp){
//        cout << itr.first << " " << itr.second << endl;
//    }
}



Measured memory_bytes: 256