# 54
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


def ruiseki_xor(n):
    if n % 2 != 0:
        if (n + 1) // 2 % 2 == 0:
            return 0
        else:
            return 1
    # n は偶数
    return ruiseki_xor(n + 1) ^ (n + 1)


a, b = LI()
# a から b の 和 : (bまでの和) - (a - 1 までの和)
ans = ruiseki_xor(b) ^ ruiseki_xor(a - 1)
print(ans) import sys sys def input(): return sys.stdin.readline().strip() input def I(): return int(input()) I def LI(): return list(map(int, input().split())) LI I() for i in range(n) for i in range(n) i range(n) range n for i in range(n) I() I def IR(n): return [I() for i in range(n)] IR n n LI() for i in range(n) for i in range(n) i range(n) range n for i in range(n) LI() LI def LIR(n): return [LI() for i in range(n)] LIR n n S() for i in range(n) for i in range(n) i range(n) range n for i in range(n) S() S def SR(n): return [S() for i in range(n)] SR n n def S(): return input() S def LS(): return input().split() LS INF = float('inf') INF float('inf') float 'inf' def ruiseki_xor(n):
    if n % 2 != 0:
        if (n + 1) // 2 % 2 == 0:
            return 0
        else:
            return 1
    # n は偶数
    return ruiseki_xor(n + 1) ^ (n + 1) ruiseki_xor if n % 2 != 0:
        if (n + 1) // 2 % 2 == 0:
            return 0
        else:
            return 1
    # n は偶数
     n % 2 != 0 n % 2 n 2 0 if (n + 1) // 2 % 2 == 0:
            return 0
        else:
            return 1
    # n は偶数
     (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 return ruiseki_xor(n + 1) ^ (n + 1) ruiseki_xor(n + 1) ^ (n + 1) ruiseki_xor(n + 1) ruiseki_xor n + 1 n 1 n + 1 n 1 n n a, b = LI() a LI() LI b ans = ruiseki_xor(b) ^ ruiseki_xor(a - 1) ans ruiseki_xor(b) ^ ruiseki_xor(a - 1) ruiseki_xor(b) ruiseki_xor b ruiseki_xor(a - 1) ruiseki_xor a - 1 a 1 print(ans) print ans def ruiseki_xor(n):
    if n % 2 != 0:
        if (n + 1) // 2 % 2 == 0:
            return 0
        else:
            return 1
    # n は偶数
    return ruiseki_xor(n + 1) ^ (n + 1) def ruiseki_xor(n):
    if n % 2 != 0:
        if (n + 1) // 2 % 2 == 0:
            return 0
        else:
            return 1
    # n は偶数
    return ruiseki_xor(n + 1) ^ (n + 1) ruiseki_xor def S(): return input() def S(): return input() S def LI(): return list(map(int, input().split())) def LI(): return list(map(int, input().split())) LI def LS(): return input().split() def LS(): return input().split() LS def LIR(n): return [LI() for i in range(n)] def LIR(n): return [LI() for i in range(n)] LIR a, b = LI() LI() a INF = float('inf') float('inf') INF def I(): return int(input()) def I(): return int(input()) I def input(): return sys.stdin.readline().strip() def input(): return sys.stdin.readline().strip() input def IR(n): return [I() for i in range(n)] def IR(n): return [I() for i in range(n)] IR ans = ruiseki_xor(b) ^ ruiseki_xor(a - 1) ruiseki_xor(b) ^ ruiseki_xor(a - 1) ans b = LI() LI() b def SR(n): return [S() for i in range(n)] def SR(n): return [S() for i in range(n)] SR
# 54
import sys


def input(): return sys.stdin.readline().strip()
def I(): return int(input())
def LI(): return list(map(int, input().split()))
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def S(): return input()
def LS(): return input().split()


INF = float('inf')


def ruiseki_xor(n):
    if n % 2 != 0:
        if (n + 1) // 2 % 2 == 0:
            return 0
        else:
            return 1
    # n は偶数
    return ruiseki_xor(n + 1) ^ (n + 1)


a, b = LI()
# a から b の 和 : (bまでの和) - (a - 1 までの和)
ans = ruiseki_xor(b) ^ ruiseki_xor(a - 1)
print(ans)
