#import <stdio.h>

typedef unsigned long long UINT;

int main(){
    UINT a,b;
    scanf("%llu %llu", &a,&b);
    UINT s=a;
    for (UINT i=a+1;i<=b;i++){
        s=s^i;
    }
    printf("%llu\n", s);
    return 0;
}