a, b = map(int, input().split())

def cal_xor(n):
    if n % 2 == 0:
        if (n // 2) % 2 == 0:
            return 0 ^ n
        else:
            return 1 ^ n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1

print(cal_xor(b)^cal_xor(a-1)) a, b = map(int, input().split()) a map(int, input().split()) map int input().split() ().split () input split b def cal_xor(n):
    if n % 2 == 0:
        if (n // 2) % 2 == 0:
            return 0 ^ n
        else:
            return 1 ^ n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 cal_xor if n % 2 == 0:
        if (n // 2) % 2 == 0:
            return 0 ^ n
        else:
            return 1 ^ n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 n % 2 == 0 n % 2 n 2 0 if (n // 2) % 2 == 0:
            return 0 ^ n
        else:
            return 1 ^ n
     (n // 2) % 2 == 0 (n // 2) % 2 n // 2 n 2 2 0 return 0 ^ n 0 ^ n 0 n return 1 ^ n 1 ^ n 1 n if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 ((n+1)//2) % 2 == 0 ((n+1)//2) % 2 (n+1)//2 n+1 n 1 2 2 0 return 0 0 return 1 1 n n print(cal_xor(b)^cal_xor(a-1)) print cal_xor(b)^cal_xor(a-1) cal_xor(b) cal_xor b cal_xor(a-1) cal_xor a-1 a 1 b = map(int, input().split()) map(int, input().split()) b a, b = map(int, input().split()) map(int, input().split()) a def cal_xor(n):
    if n % 2 == 0:
        if (n // 2) % 2 == 0:
            return 0 ^ n
        else:
            return 1 ^ n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 def cal_xor(n):
    if n % 2 == 0:
        if (n // 2) % 2 == 0:
            return 0 ^ n
        else:
            return 1 ^ n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1 cal_xor
a, b = map(int, input().split())

def cal_xor(n):
    if n % 2 == 0:
        if (n // 2) % 2 == 0:
            return 0 ^ n
        else:
            return 1 ^ n
    else:
        if ((n+1)//2) % 2 == 0:
            return 0
        else:
            return 1

print(cal_xor(b)^cal_xor(a-1))