/*
    --------DO NOT COPY I REQUEST YOU PLEASE--------
     
    AUTHOR : Chandan Agrawal
    College : Poornima College of Engg. jaipur, Raj
    Mail : chandanagrawal23@gmail.com
     
     
      ___  _   _    __    _  _  ____    __    _  _
     / __)( )_( )  /__\  ( \( )(  _ \  /__\  ( \( )
    ( (__  ) _ (  /(__)\  )  (  )(_) )/(__)\  )  (
     \___)(_) (_)(__)(__)(_)\_)(____/(__)(__)(_)\_)
     
    */
    #include<bits/stdc++.h>
    using namespace std;
    #define fastIO ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
    #include<cstdio>
    #define MAX 10000001
    #include<stdio.h>
    #include<vector>
    #include<set>
    #include<map>
    #include<queue>
    #include<stack>
    #include<string>
    #include<algorithm>
    #include<functional>
    #include<iomanip>
    #include<cstdio>
    #include<cmath>
    #include<cstring>
     
    #include<cstdlib>
    #include<cassert>
    #include<unordered_map>
    #define ll long long
    #define ld long double
    #define lli long long int
    #define pb push_back
    #define inf 1000000000
    #define mod 1000000007
    #define MOD 1000000007
    //#define mp make_pair
    #define loop(i,n) for (lli i = 0; i < n; i++)
    #define FOR(i,a,b) for (lli i = a; i < b; i+=1)
    #define loop_rev(i,n) for (lli i = n-1; i >= 0; i--)
    #define FOR_REV(i,a,b) for (lli i = a; i >= b; i--)
    #define all(v) v.begin(),v.end()
    #define pii pair<int,int>
    #define F first
    #define S second
    #define mii map<lli,lli>
    #define vi vector<lli>
    #define vc vector<char>
    #define itr :: iterator it
    #define WL(t) while(t --)
    #define fd(n)       fixed<<setprecision(n)
    #define gcd(a,b) __gcd((a),(b))
    #define lcm(a,b) (a/gcd(a,b))*b
    #define abs(x) ((x < 0)?-(x):x)
     
    #define print(x) printf("%lli\n",x);
    #define print2(x,y) printf("%lli %lli\n",x,y);
    #define print3(x,y,z) printf("%lli %lli %lli\n",x,y,z);
     
    #define scan(x) scanf("%lld",&x);
    #define scan2(x,y) scanf("%lld %lld",&x,&y);
    #define scan3(x,y,z) scanf("%lld %lld %lld",&x,&y,&z);
     
    #define scanarr(a,n) for(lli i=0;i<n;i++)    cin>>a[i];
    #define scanvector(a,n) for(lli i=0;i<n;i++){ lli x ; cin>>x; a.push_back(x);}
     
    #define printarr(a,n) for(lli i=0;i<n;i++)   printf("%lli ",a[i]); printf("\n");
    #define printvector(a,n) for(lli i=0;i<n;i++)   printf("%lli ",a[i]); printf("\n");
     
    #define YES printf("YES\n");
    #define Yes printf("Yes\n");
    #define yes printf("yes\n");
    #define NO  printf("NO\n");
    #define No  printf("No\n");
    #define no  printf("no\n");
     
    #define endl '\n'
     
    #define deb(x) cout<<#x<<" "<<x<<endl;
    ll lcm2(ll a,ll b){return (a*b)/ __gcd(a,b);}
    ll lcm3(ll a, ll b, ll c){ return lcm2(a,lcm2(b,c));}
    ll lcm4(ll a,ll b, ll c, ll d){ return lcm2(lcm2(a,b), lcm2(c,d));}
    bool isprime(lli n){
    if(n<=1) return false;
    if(n<=3) return true;
    if(n==5) return true;
    if((n%2==0)||(n%3==0) || (n%5==0)) return false;
    for(lli i=5;i*i<=n;i+=6)
        if((n%i==0)||(n%(i+2)==0))
            return false;
    return true;
    }
    ll modmul(ll a, ll b) {
	return (((a%mod) * (b%mod)) % mod+mod)%mod;
}

ll modadd(ll a , ll b){
    return(((a%mod)+(b%mod))%mod+mod)%mod;
}

ll modsub(ll a , ll b){
    return((a%mod) - (b%mod) + mod)%mod;
}
bool isup(lli x0,lli y0,lli x1,lli y1){
    return(x0==x1 && y1>y0);
}
bool isbot(lli x0,lli y0,lli x1,lli y1){
    return(x0==x1 && y1<y0);
}
bool isleft(lli x0,lli y0,lli x1,lli y1){
    return(x0>x1 && y1==y0);
}
bool isright(lli x0,lli y0,lli x1,lli y1){
    return(x0<x1 && y1==y0);
}
bool isvowel(char ch){
    return (ch=='a'||ch=='e'||ch=='i'||ch=='o'||ch=='u'||ch=='A'||ch=='E'||ch=='I'||ch=='O'||ch=='U');
}
lli MYXOR(lli n) 
{ 
    if(n==-1)
        return 0;
    // Modulus operator are expensive on most of the  
    // computers. n & 3 will be equivalent to n % 4.    
  
    switch(n & 3) // n % 4  
    { 
    case 0: return n;     // if n is multiple of 4 
    case 1: return 1;     // If n % 4 gives remainder 1   
    case 2: return n + 1; // If n % 4 gives remainder 2     
    case 3: return 0;     // If n % 4 gives remainder 3   
    } 
        return 0;
} 
    int main(){
    fastIO
    //myfunc();
    lli t=1;
    //cin>>t;
    //ld sum=0.0;
        while(t--){
            lli a,b;
            cin>>a>>b;
            cout<<(MYXOR(b) ^ MYXOR(a-1));
            
    }
    return 0;
    }

Measured memory_bytes: 256