// #include <ext/pb_ds/assoc_container.hpp> 
                                         // #include <ext/pb_ds/tree_policy.hpp> 
                                            #include <iostream>
                                            #include <iomanip>
                                            #include <sstream>
                                            #include <cstring>
                                            #include <vector>
                                            #include <deque>
                                            #include <queue>
                                            #include <set>
                                            #include <map>
                                            #include <valarray>
                                            #include <iterator>
                                            #include <functional>
                                            #include <limits>
                                            #include <algorithm>
                                            #include <numeric>
                                            #include <cmath>
                                            #include <cassert>
                                            #include <unordered_map>
                                            #include <unordered_set>
                                            #include <stack>
                                            using namespace std;
                                            #define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
                                             #define trace(x) cerr << #x << ": " << x << " " << endl;
                                         
                                            typedef int64_t ll;
                                         
                                            #define endl '\n'
                                            #define int ll
                                            ll mod=1e9+7;
                                            ll mod1=1e9+6;
                                            
                                            ll power(ll a,ll b)
                                            {
                                                if(b==0) return 1;
                                                else if(b%2==0)
                                                    return power((((a%mod)*(a%mod))%mod),b/2)%mod;
                                                else return ((a%mod)*(power((((a%mod)*(a%mod))%mod),b/2)%mod))%mod;
                                            }
                                           
                                          //  using namespace __gnu_pbds;
                                           // #define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>
                                            //find_by_order(k)  returns iterator to kth element starting from 0;
                                            //order_of_key(k) returns count of elements strictly smaller than k;
                                            //erase,insert same as normal set
                                        int comp(int n)
                                        {
                                            vector<int> v;
                                            int te=n;
                                            while(te)
                                            {
                                                v.push_back(te%2);
                                                te/=2;
                                            }
                                            reverse(v.begin(),v.end());
                                            int cnt[(int)v.size()+1];;
                                            memset(cnt,0,sizeof(cnt));
                                            for(int i=0;i<v.size();++i)
                                            {
                                                int rem=(int)v.size()-i-1;
                                                //rem--;

                                                if(v[i]==0)
                                                    continue;
                                                else
                                                {
                                                    rem--;
                                                    if(rem<0)
                                                    {
                                                        cnt[i]++;
                                                        continue;
                                                    }
                                                    for(int j=i+1;j<v.size();++j)
                                                        cnt[j]+=(1ll<<rem);
                                                    for(int j=i+1;j<v.size();++j)
                                                    {
                                                        if(v[j])
                                                        {
                                                            int te=int(v.size())-j-1;

                                                             
                                                            cnt[i]+=(1ll<<te);
                                                        }
                                                    }
                                                    cnt[i]++;
                                                }
                                            }

                                             te=v.size();
                                            int ans=0;
                                            
                                            for(int j=v.size()-1;j>=0;--j)
                                            {
                                              //  cout<<cnt[j]<<" ";
                                                if(cnt[j]%2)
                                                {
                                                    ans|=(1ll<<(te-j-1));
                                                }
                                            }
                                            return ans;
                                        }
                                        int32_t main()
                                        {
                                            IOS
                                         
                                            
                                            int a,b;
                                            cin>>a>>b;
                                            if(a==0)
                                            {
                                                cout<<comp(b);
                                                return 0;
                                            }
                                            else
                                            {
                                                cout<<(comp(b)^comp(a-1));
                                                return 0;
                                            }
                                                                                      

                                            
                                        
                                        }                   

Measured memory_bytes: 256