You are given an integer sequence $1, 2, \dots, n$. You have to divide it into two sets $A$ and $B$ in such a way that each element belongs to exactly one set and $|sum(A) - sum(B)|$ is minimum possible.

The value $|x|$ is the absolute value of $x$ and $sum(S)$ is the sum of elements of the set $S$.


-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 2 \cdot 10^9$).


-----Output-----

Print one integer — the minimum possible value of $|sum(A) - sum(B)|$ if you divide the initial sequence $1, 2, \dots, n$ into two sets $A$ and $B$.


-----Examples-----
Input
3

Output
0

Input
5

Output
1

Input
6

Output
1



-----Note-----

Some (not all) possible answers to examples:

In the first example you can divide the initial sequence into sets $A = \{1, 2\}$ and $B = \{3\}$ so the answer is $0$.

In the second example you can divide the initial sequence into sets $A = \{1, 3, 4\}$ and $B = \{2, 5\}$ so the answer is $1$.

In the third example you can divide the initial sequence into sets $A = \{1, 4, 5\}$ and $B = \{2, 3, 6\}$ so the answer is $1$.

Difficulty: EASY
Tags: Mathematics

Starter code:

Solutions:
gi = lambda : list(map(int, input().strip().split()))
(n,) = gi()
print(n * (n + 1) // 2 % 2)


n = int(input())
print(int(n * (n + 1) // 2 % 2))


n = int(input())
total = n * (n + 1) // 2
if total % 2 == 0:
	print('0')
else:
	print('1')


import sys
import math
import random
input = sys.stdin.readline

def inp():
	return int(input())

def inara():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
n = inp()
n *= n + 1
n //= 2
print(n % 2)


def ii():
	return int(input())

def fi():
	return float(input())

def si():
	return input()

def mi():
	return map(int, input().split())

def li():
	return list(mi())
import string
n = ii()
a = n * (n + 1)
a //= 2
if a % 2 == 1:
	print(1)
else:
	print(0)


n = int(input())
x = n * (n + 1) // 2
if x % 2 == 0:
	print('0')
else:
	print('1')


a = int(input()) - 1
a = a % 4
if a == 0 or a == 1:
	print(1)
else:
	print(0)


n = int(input())
a = []
if n % 2 == 0:
	a = [n - 1, n]
	if n > 2:
		if a[1] % 4 == 0:
			print(0)
		else:
			print(1)
	else:
		print(1)
else:
	a = [n, n + 1]
	if a[1] % 4 == 0:
		print(0)
	else:
		print(1)


print('0110'[int(input()) % 4])


print(int(int(input()) % 4 in [1, 2]))


n = int(input())
if n == 0:
	print(0)
elif n % 4 == 0 or n % 4 == 3:
	print(0)
else:
	print(1)


n = int(input())
if n % 2 != 0:
	if (n + 1) // 2 % 2 == 0:
		print('0')
	else:
		print('1')
elif n // 2 % 2 == 0:
	print('0')
else:
	print('1')


n = int(input())
t = n * (n + 1)
k = t // 2
if k % 2 == 0:
	print(0)
else:
	print(1)


def solve(n):
	mod = n % 200
	if n < 1 or mod == 0:
		return 0
	v = 1
	while v <= mod:
		if v == mod:
			return 1
		v += 1
		if v == mod:
			return 1
		v += 1
		if v == mod:
			return 0
		v += 1
		if v == mod:
			return 0
		v += 1
	return 0
n = int(input())
print(solve(n))


n = int(input())
print(1 if n % 4 == 1 or n % 4 == 2 else 0)


n = int(input())
if n == 3:
	print(0)
elif n < 3:
	print(1)
elif n % 2 == 1:
	if (n - 3) % 4 == 0:
		print(0)
	else:
		print(1)
elif n % 4 == 0:
	print(0)
else:
	print(1)


def hack(n):
	if (n - 1) % 4 > 1:
		return 0
	return 1
n = int(input())
print(hack(n))


n = int(input())
a = n % 4
if a == 0 or a == 3:
	print('0')
elif a == 1 or a == 2:
	print('1')


n = int(input())
if n % 2 == 0:
	nh = n // 2
else:
	nh = n // 2 + 1
if nh % 2 == 0:
	print(0)
else:
	print(1)


import math
n = int(input())
x = math.ceil(n / 2)
if x % 2 == 0:
	print(0)
else:
	print(1)


n = int(input()) % 4
if n in [0, 3]:
	print(0)
else:
	print(1)


import sys
IN = sys.stdin.readline
c = int(IN())
c = c * (c + 1) // 2
print(c % 2)


N = int(input())
if N * (N + 1) // 2 % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
s = n * (2 + (n - 1))
s = s // 2
if s % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
rem = n % 4
if rem == 0 or rem == 3:
	print(0)
else:
	print(1)


N = int(input())
if N % 4 == 1 or N % 4 == 2:
	print(1)
else:
	print(0)


def dividing(n):
	if n % 4 == 0:
		return 2
	if n % 2 == 0:
		return 1
	return 0
n = int(input())
count1 = dividing(n)
count2 = dividing(n + 1)
if count1 + count2 >= 2:
	print('0')
else:
	print('1')


d = [1, 1, 0, 0]
n = int(input()) - 1
print(d[n % 4])


print((int(input()) + 1) // 2 % 2)


n = int(input())
print(n * (n + 1) // 2 % 2 == 1 and 1 or 0)


n = int(input())
if n * (n + 1) % 4 == 0:
	print(0)
else:
	print(1)


def raspil(n):
	if n % 4 == 0 or n % 4 == 3:
		return 0
	if n % 4 == 1 or n % 4 == 2:
		return 1
print(raspil(int(input())))


n = int(input())
if n % 2:
	p = 1 + n // 2
	s = p * n
else:
	p = n // 2
	s = p * (n - 1) + n
if not s % 2:
	print(0)
else:
	print(1)


n = int(input())
print({0: 0, 1: 1, 2: 1, 3: 0}[n % 4])


n = int(input())
y = n * (n + 1) // 2
if y % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
if n == 1 or n == 2 or n == 5 or (n == 6):
	print(1)
elif n == 3 or n == 4:
	print(0)
elif n % 4 == 0 or n % 4 == 3:
	print(0)
else:
	print(1)


import sys, os, io

def rs():
	return sys.stdin.readline().rstrip()

def ri():
	return int(sys.stdin.readline())

def ria():
	return list(map(int, sys.stdin.readline().split()))

def ws(s):
	sys.stdout.write(s + '\n')

def wi(n):
	sys.stdout.write(str(n) + '\n')

def wia(a):
	sys.stdout.write(' '.join([str(x) for x in a]) + '\n')
import math, datetime, functools, itertools, operator, bisect
from collections import deque, defaultdict, OrderedDict
N = 1000001
p = 10 ** 9 + 7
fact = [None] * (N + 1)
fact[0] = 1
for i in range(1, N + 1):
	fact[i] = fact[i - 1] * i % p

def main():
	starttime = datetime.datetime.now()
	if os.path.exists('input.txt'):
		sys.stdin = open('input.txt', 'r')
		sys.stdout = open('output.txt', 'w')
	for _ in range(1):
		n = ri()
		ans = n * (n + 1) // 2
		if ans % 2 == 0:
			print(0)
		else:
			print(1)
	endtime = datetime.datetime.now()
	time = (endtime - starttime).total_seconds() * 1000
	if os.path.exists('input.txt'):
		print('Time:', time, 'ms')

class FastReader(io.IOBase):
	newlines = 0

	def __init__(self, fd, chunk_size=1024 * 8):
		self._fd = fd
		self._chunk_size = chunk_size
		self.buffer = io.BytesIO()

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self, size=-1):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, self._chunk_size if size == -1 else size))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

class FastWriter(io.IOBase):

	def __init__(self, fd):
		self._fd = fd
		self.buffer = io.BytesIO()
		self.write = self.buffer.write

	def flush(self):
		os.write(self._fd, self.buffer.getvalue())
		(self.buffer.truncate(0), self.buffer.seek(0))

class FastStdin(io.IOBase):

	def __init__(self, fd=0):
		self.buffer = FastReader(fd)
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

class FastStdout(io.IOBase):

	def __init__(self, fd=1):
		self.buffer = FastWriter(fd)
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.flush = self.buffer.flush
sys.stdin = FastStdin()
sys.stdout = FastStdout()
main()


def solve():
	n = int(input())
	sum_ = n * (n + 1) // 2
	print(1 if sum_ % 2 == 1 else 0)
solve()


n = int(input())
if not n % 4 or not (n + 1) % 4:
	print(0)
else:
	print(1)


import decimal
D = decimal.Decimal

def answer():
	n = D(int(input()))
	if n == 3:
		print(0)
	elif D(n % 4) == 0:
		print(0)
	elif D(n % 4) == 1:
		print(1)
	elif D(n % 4) == 2:
		print(1)
	elif D(n % 4) == 3:
		print(0)
answer()


t = int(input())
if t * (t + 1) % 4 == 0:
	print(0)
else:
	print(1)


import sys
for y in sys.stdin:
	print([1 if (int(y) - 1) % 4 < 2 else 0][0])


def A():
	n = int(input())
	if n % 4 in [1, 2]:
		print(1)
		return
	else:
		print(0)
A()


import math
n = int(input())
a = n * (n + 1) // 2
if a % 2 == 0:
	print('0')
else:
	print('1')


a = int(input())
print((a + 1) // 2 % 2)


rd = lambda : list(map(int, input().split()))
n = rd()[0]
print(int(n % 4 == 1 or n % 4 == 2))


n = int(input())
m = n * (n + 1) // 2
if m % 2 == 0:
	print(0)
else:
	print(1)


x = int(input())
if x % 4 == 1 or x % 4 == 2:
	print(1)
else:
	print(0)


n = int(input())
seta = (n + 1) * n // 2
if seta % 2 == 0:
	print(0)
else:
	print(1)


a = int(input())
if a == 1 or a == 2:
	print(1)
elif a % 4 == 0:
	print(0)
elif a % 2 == 0 and a % 4 != 0:
	print(1)
elif a % 2 == 1 and (a - 1) % 4 == 0:
	print(1)
else:
	print(0)


n = int(input())
if n % 4 == 0 or n % 4 == 3:
	print('0')
if n % 4 == 1 or n % 4 == 2:
	print('1')


n = int(input())
su = n * (n + 1) // 2
if su % 2 == 0:
	print(0)
else:
	print(1)


a = int(input())
check = 0
if a % 2 == 0:
	if a / 2 % 2 == 0:
		print(0)
		check = 1
elif (a + 1) % 2 == 0:
	if (a + 1) / 2 % 2 == 0:
		print(0)
		check = 1
if check == 0:
	print(1)


n = int(input())
a = n % 4 == 1 or n % 4 == 2
if a == False:
	print(0)
else:
	print(1)


from math import ceil as c
print(c(int(input()) / 2) % 2)


na = int(input())
if na % 2 == 0:
	kam = na // 2
	if kam % 2 != 0:
		print(1)
	else:
		print(0)
else:
	kam = na // 2
	if kam % 2 != 0:
		print(0)
	else:
		print(1)


a = int(input())
suma = a * (a + 1) // 2
print(1 if suma % 2 else 0)


N = int(input())
if N % 4 == 3 or N % 4 == 0:
	print(0)
else:
	print(1)


def read(type=1):
	if type:
		file = open('input.dat', 'r')
		n = int(file.readline())
		file.close()
	else:
		n = int(input().strip())
	return n

def solve():
	if n % 4 == 0 or n % 4 == 3:
		return 0
	else:
		return 1
n = read(0)
sol = solve()
print(sol)


from math import floor
n = int(input())
res = (1 + floor((n - 1) // 2)) % 2
print(res)


num = int(input())
if num % 4 == 0 or num % 4 == 3:
	print(0)
else:
	print(1)


n = int(input())
a = [0, 1, 1, 0]
print(a[n % 4])


from math import ceil as c
n = int(input())
k = c(n / 2)
print([0, 1][k % 2])


a = int(input()) % 4
a = 1 if a == 2 else a
a = 0 if a == 3 else a
print(a)


n = int(input())
sum = n * (n + 1) // 2
if sum % 2 == 0:
	print('0')
else:
	print('1')


x = int(input())
l = x * (x + 1) // 2
if l % 2 == 0:
	print(0)
elif l % 2 != 0:
	print(1)


from sys import stdin

def main():
	n = int(stdin.readline())
	if n * (n + 1) // 2 % 2 == 0:
		print(0)
	else:
		print(1)
main()


import math
n = int(input())
if n % 2 == 0 and n / 2 % 2 == 0:
	print(0)
elif n % 2 == 0 and n / 2 % 2 == 1:
	print(1)
elif (n + 1) / 2 % 2 == 1:
	print(1)
else:
	print(0)


x = int(input())
if x % 4 == 0:
	print(0)
elif x % 4 == 1:
	print(1)
elif x % 4 == 2:
	print(1)
elif x % 4 == 3:
	print(0)


import os
import sys
from io import BytesIO, IOBase

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def count1(s):
	c = 0
	for i in s:
		if i == '1':
			c += 1
	return c

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True
n = int(input())
if n % 4 == 0 or n % 4 == 3:
	print(0)
else:
	print(1)


n = int(input())
temp = n * (n + 1) // 2
if temp % 2 == 0:
	print(0)
else:
	print(1)


print([0, 1, 1, 0][int(input()) % 4])


n = int(input())
x = n % 4
if x == 0 or x == 3:
	print('0')
else:
	print('1')


n = int(input())
suma = n * (n + 1) // 2
if suma % 2 == 0:
	print(0)
else:
	print(1)


x = int(input())
print((x + x ** 2) // 2 & 1)


import sys
from math import ceil
from collections import deque
n = int(input())
print(n * (n + 1) // 2 % 2)


n = int(input())
if not n % 4:
	print(0)
elif n % 4 == 1 or n % 4 == 2:
	print(1)
else:
	print(0)


i = int(input())
if i % 4 == 0 or i % 4 == 3:
	print(0)
else:
	print(1)


def minDifference(number):
	mod = number % 4
	return 0 if mod == 0 or mod == 3 else 1
print(minDifference(int(input())))


def main():
	n = int(input())
	if n % 4 == 1 or n % 4 == 2:
		print(1)
	else:
		print(0)
main()


import sys

def main():
	n = int(sys.stdin.read().strip())
	return (1 + n) * n // 2 % 2
print(main())


n = int(input())
if n % 2 == 0:
	if n % 4 == 0:
		print(0)
	else:
		print(1)
else:
	c = n // 2
	if c % 2 == 1:
		print(0)
	else:
		print(1)


import sys
num = int(sys.stdin.read())
sum = num * (num + 1) // 2
print(sum % 2)


a = input()
b = int(a)
b %= 4
if b == 0 or b == 3:
	print(0)
else:
	print(1)


n = int(input())
print(1 - (4 - -n % 4) // 3)


def main():
	n = int(input())
	summ = (1 + n) * n // 2
	if summ % 2 == 0:
		print(0)
	else:
		print(1)
main()


from math import *
from copy import *
from string import *
from sys import stdin
from itertools import *
from collections import Counter
N = int(stdin.readline())
ans = N * (N + 1) // 2
print(ans % 2)


k = int(input())
if k % 4 == 0 or k % 4 == 3:
	print(0)
else:
	print(1)


def subsetDifference(n):
	s = int(n * (n + 1) / 2)
	if n % 4 == 0:
		print(0)
	elif n % 4 == 1 or n % 4 == 2:
		print(1)
	else:
		print(0)
n = int(input())
subsetDifference(n)


def sint():
	return int(input())

def sints():
	return map(int, input().split())

def sara():
	return list(map(int, input().split()))

def sstr():
	s = input()
	return list(s[:len(s)])

def main():
	n = sint()
	m = n % 4
	if m == 1 or m == 2:
		print(1)
	else:
		print(0)
main()


n = int(input())
n = (n * n + n) // 2 % 2
print(n)


from sys import stdin
n = int(stdin.readline())

def ans():
	a = n % 4
	if a == 0 or a == 3:
		print(0)
	elif a == 1 or a == 2:
		print(1)
ans()


n = int(input())
val = n * (n + 1) // 2
if val % 2 == 0:
	print(0)
else:
	print(1)


x = input()
y = int(x)
if y == 2:
	answer = 1
elif y % 4 == 3 or y % 4 == 0:
	answer = 0
elif y % 4 == 1 or y % 1 == 0:
	answer = 1
print(answer)


n = int(input())
n = n / 2
n += 0.5
n = int(n)
if n % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
m = n % 4
if m == 0 or m == 3:
	print(0)
else:
	print(1)


n = int(input())
ryad = n * (n + 1) // 2
sum1 = ryad // 2
sum2 = ryad - sum1
print(abs(sum1 - sum2))


def isd():
	n = int(input())
	n = n % 4
	if n == 0 or n == 3:
		print(0)
	else:
		print(1)
i = isd()


n = int(input())
s = n * (n + 1) // 2
if s % 2 == 0:
	print(0)
elif s % 2 == 1:
	print(1)


x = eval(input())
s = x * (x + 1) // 2
if s % 2 == 0:
	print(0)
else:
	print(1)


N = int(input())
print(0 if N % 4 in (0, 3) else 1)


import math

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(mi())
n = ii()
n = n % 4
if n == 1:
	print(1)
elif n == 2:
	print(1)
else:
	print(0)


a = str(input())
if len(a) == 1:
	a = '0' + a
chk = int(a[-2])
if chk % 2 == 0:
	if a[-1] == '1' or a[-1] == '2' or a[-1] == '5' or (a[-1] == '6') or (a[-1] == '9'):
		st = 1
	else:
		st = 0
elif a[-1] == '1' or a[-1] == '2' or a[-1] == '5' or (a[-1] == '6') or (a[-1] == '9'):
	st = 0
else:
	st = 1
print(st)


import sys
import math
from collections import defaultdict
from collections import deque

def getInputFromLine():
	return [int(x) for x in input().split()]
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
n = int(input())
s = n * (n + 1)
if s % 4 == 0:
	print(0)
else:
	print(1)


n = int(input())
ans = 0
t = n % 4
if t == 1 or t == 2:
	ans = 1
print(ans)


n = int(input())
n %= 4
print(['1', '0'][n == 0 or n == 3])


def sol():
	n = int(input())
	print('0' if n * (n + 1) % 4 == 0 else '1')
sol()


import sys
import math
sys.setrecursionlimit(10 ** 9)
n = int(sys.stdin.readline())
if n == 0:
	print(0)
elif n == 1:
	print(1)
elif n == 2:
	print(1)
elif n % 2 == 1 and (n + 1) % 4 != 0:
	print(1)
elif n % 2 == 1:
	print(0)
elif n // 2 % 2 == 0:
	print(0)
else:
	print(1)


import sys

def getAndParseInt(num=1):
	string = sys.stdin.readline().strip()
	if num == 1:
		return int(string)
	else:
		return [int(part) for part in string.split()]

def getAndParseString(num=1, delim=''):
	string = sys.stdin.readline().strip()
	if num == 1:
		return string
	elif delim != '':
		return [part for part in string.split(delim)]
	else:
		return [part for part in string.split()]
n = getAndParseInt()
if n == 1 or n == 2:
	print(1)
elif n % 4 == 0 or (n - 3) % 4 == 0:
	print(0)
else:
	print(1)


n = int(input())
print(int(n % 4 != 0 and (n + 1) % 4 != 0))


import math as mt
n = int(input())
p = (n ** 2 + n) // 2
if p % 2 == 0:
	print(0)
else:
	print(1)


a = int(input()) % 4
results = [0, 1, 1, 0]
print(results[a])


x = int(input())
sum = x * (x + 1) // 2
if sum % 2 == 0:
	print(0)
else:
	print(1)


n = input()[-2:]
m = int(n) % 4
if m in (0, 3):
	print(0)
else:
	print(1)


n = int(input())
if n % 2 == 0:
	r = n // 2
	if r % 2 == 0:
		print(0)
	else:
		print(1)
else:
	r = n // 2
	if (r + 1) % 2 == 0:
		print(0)
	else:
		print(1)


t = int(input())
n = t % 4
if n == 0 or n == 3:
	print(0)
else:
	print(1)


print((lambda x: 0 if x % 4 == 0 or (x + 1) % 4 == 0 else 1)(int(input())))


k = int(input())
print(k * (k + 1) // 2 % 2)


n = int(input())
f = n * (n + 1) // 2
if f % 2 == 0:
	print(0)
else:
	print(1)


x = int(input())
y = 0
if x % 2 == 0:
	y = x // 2 - 1
else:
	y = x // 2
if y % 2 == 0:
	print('1')
else:
	print('0')


n = input()
n = int(n)
if n == 0:
	print(0)
elif n == 1:
	print(1)
elif n >= 2:
	if n % 2 == 0:
		a = n // 2
		if a % 2 == 0:
			print(0)
		else:
			print(1)
	else:
		m = n - 1
		a = m // 2
		if a % 2 != 0:
			print(0)
		else:
			print(1)


print((int(input()) & 3) % 3 and 1)


n = int(input())
if n % 4 in [1, 2]:
	print(1)
else:
	print(0)


n = int(input().strip())
if (n + 3) % 4 < 2:
	print(1)
else:
	print(0)


N = int(input())
if N % 2 == 0:
	if N % 4 == 0:
		print(0)
	else:
		print(1)
elif (N - 1) % 4 == 0:
	print(1)
else:
	print(0)


def sx(n):
	print(n * (n + 1) // 2 % 2)
s = int(input())
sx(s)


def solve():
	n = int(input())
	total = n * (n + 1) // 2
	if total % 2 == 0:
		print(0)
	else:
		print(1)
solve()


from __future__ import division, print_function
from fractions import Fraction
import sys
import os
from io import BytesIO, IOBase
from itertools import *
import bisect
from heapq import *
from math import *
from copy import *
from collections import deque
from collections import Counter as counter
from itertools import combinations as comb
from itertools import permutations as permutate
from bisect import bisect_left as bl
from bisect import bisect_right as br
from bisect import bisect
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')

def print(*args, **kwargs):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', sys.stdout))
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop('end', '\n'))
	if kwargs.pop('flush', False):
		file.flush()
if sys.version_info[0] < 3:
	(sys.stdin, sys.stdout) = (FastIO(sys.stdin), FastIO(sys.stdout))
else:
	(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
from types import GeneratorType

def iterative(f, stack=[]):

	def wrapped_func(*args, **kwargs):
		if stack:
			return f(*args, **kwargs)
		to = f(*args, **kwargs)
		while True:
			if type(to) is GeneratorType:
				stack.append(to)
				to = next(to)
				continue
			stack.pop()
			if not stack:
				break
			to = stack[-1].send(to)
		return to
	return wrapped_func
mod = 1000000007

def inp():
	return sys.stdin.readline().rstrip('\r\n')

def out(var):
	sys.stdout.write(str(var))

def lis():
	return list(map(int, inp().split()))

def stringlis():
	return list(map(str, inp().split()))

def sep():
	return map(int, inp().split())

def strsep():
	return map(str, inp().split())

def zerolist(n):
	return [0] * n

def nextline():
	out('\n')

def testcase(t):
	for pp in range(t):
		solve(pp)

def printlist(a):
	for p in range(0, len(a)):
		out(str(a[p]) + ' ')

def google(p):
	print('Case #' + str(p) + ': ', end='')

def lcm(a, b):
	return a * b // gcd(a, b)

def power(x, y, p):
	res = 1
	x = x % p
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x % p
		y = y >> 1
		x = x * x % p
	return res

def ncr(n, r):
	return factorial(n) // (factorial(r) * factorial(max(n - r, 1)))

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True

def solve(case):
	n = int(inp())
	n %= 4
	if n == 1 or n == 2:
		print(1)
	else:
		print(0)
testcase(1)


def check(n):
	if n // 2 % 2 == 1:
		return 0
	return 1
n = int(input())
if n % 2 == 1:
	print(check(n))
else:
	print(check(n - 1))


n = int(input())
tmp = 0
if n % 2 == 0:
	tmp = n + 1
	n = n / 2
else:
	tmp = (n + 1) / 2
if tmp % 2 != 0 and n % 2 != 0:
	print(1)
else:
	print(0)


n = int(input())
mod = n % 4
if mod == 0 or mod == 3:
	print('0')
else:
	print('1')


n = int(input())
summ = n * (n + 1) // 2
if summ % 2 == 0:
	print(0)
else:
	print(1)


from sys import stdin
n = int(input())
if n % 4 == 0 or n % 4 == 3:
	print(0)
else:
	print(1)


from sys import stdin
input = stdin.readline
if (int(input()) + 1) // 2 % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
res = n * (n + 1) // 2
if res % 2 == 1:
	print(1)
else:
	print(0)


b = int(input())

def solved(a):
	if a == 1 or a == 0:
		return a
	if a == 2:
		return 1
	if a == 3:
		return 0
	if a % 2 == 0:
		return 0 if a / 2 % 2 == 0 else 1
	elif (a - 1) / 2 % 2 == 1:
		return 0
	else:
		return 1
print(solved(b))


def oneortwo(n):
	if n % 2 == 1:
		if int(n / 2) % 2 == 0:
			return 1
		else:
			return 0
	elif n / 2 % 2 == 1:
		return 1
	else:
		return 0
n = int(input())
output = str(int(oneortwo(n)))
print(output)


import math
i = int(input())
i = math.ceil(i / 2)
if i % 2 == 0:
	print(0)
else:
	print(1)


i = int(input())
print(i * (i + 1) // 2 % 2)


def Sum(n):
	return n * (n + 1) // 2

def main():
	n = int(input())
	if n % 2 == 0:
		k = (n - 1) // 2
		if k % 2 == 0:
			print(1)
		else:
			print(0)
	else:
		k = (n - 1) // 2
		if k % 2 == 0:
			print(1)
		else:
			print(0)
main()


n = int(input())
res = n * (n + 1) // 2
if res % 2 == 0:
	print('0')
elif res % 2 == 1:
	print('1')


def main():
	n = int(input())
	ans = n * (n + 1) // 2
	if ans % 2 == 0:
		print('0')
	else:
		print('1')
	return
main()


q = int(input())
w = (q + 1) * q // 2
if w % 2 == 1:
	print(1)
else:
	print(0)


m = int(input())
if m % 2 == 0:
	k = m / 2
	if k % 2 == 0:
		print(0)
	else:
		print(1)
else:
	kk = int(m / 2) + 1
	if kk % 2 == 0:
		print(0)
	else:
		print(1)


n = int(input())
m = 0
if n % 4 == 0:
	print(0)
elif n % 4 == 3:
	print(0)
else:
	print(1)


from math import ceil
n = int(input())
print(int(ceil(n / 2) % 2 != 0))


n = int(input())
if n % 2 == 0:
	if n % 4 == 0:
		print('0')
	else:
		print('1')
else:
	even = n // 2
	odd = n - even
	if odd % 2 == 0:
		print('0')
	else:
		print('1')


def main():
	n = int(input())
	print(0 if n % 4 in [0, 3] else 1)
main()


import sys
data = sys.stdin.read().splitlines()
n = int(data[0])
s = n * (n + 1) // 2
print(s & 1)


class Solution(object):

	def solve(self):
		n = int(input().strip())
		if n % 2 == 0:
			if n // 2 % 2 == 0:
				return 0
			return 1
		else:
			if (n + 1) // 2 % 2 == 0:
				return 0
			return 1
sol = Solution()
print(sol.solve())


MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
(n,) = I()
n %= 4
if n == 1:
	print(1)
elif n == 2:
	print(1)
elif n == 3:
	print(0)
else:
	print(0)


from sys import stdin, stdout
from collections import Counter

def ai():
	return list(map(int, stdin.readline().split()))

def ei():
	return map(int, stdin.readline().split())

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
n = ip()
if n % 4 == 1 or n % 4 == 2:
	print(1)
elif n % 4 == 3 or n % 4 == 0:
	print(0)


from sys import stdin

def read_lines(sep=' ', input_type=None):
	_lines = stdin.readlines()
	cast = input_type is not None
	lines = []
	for line in _lines:
		line = line[:-1].split(sep)
		if cast:
			line = [input_type(x) for x in line]
		lines.append(line)
	return lines

def sequential_max_diff(seq):
	unlagged_seq = seq[:-1]
	lagged_seq = seq[1:]
	maxd = 0
	for pair in zip(unlagged_seq, lagged_seq):
		diff = abs(pair[0] - pair[1])
		if diff > maxd:
			maxd = diff
	return maxd

def main2():
	lines = read_lines(input_type=int)
	n = lines[0][0]
	heights = lines[1]
	_seq = heights
	_seq.sort()
	least = _seq[-1]
	elements = _seq
	min_pair = None
	for i in range(len(elements)):
		for j in range(len(elements)):
			if j == i:
				continue
			(a, b) = (elements[i], elements[j])
			seq = _seq.copy()
			seq.remove(a)
			seq.remove(b)
			res = max(sequential_max_diff([a] + seq + [b]), abs(a - b))
			if res < least:
				min_pair = (a, b)
				least = res
	seq = _seq.copy()
	seq.remove(min_pair[0])
	seq.remove(min_pair[1])
	out = list(map(str, [min_pair[0]] + seq + [min_pair[1]]))
	print(' '.join(out))

def main3():
	lines = read_lines(input_type=int)
	(n, m, k) = lines[0]
	v = lines[1]
	max1 = max(v)
	max2 = 0
	max_appears = 0
	for ele in v:
		if ele == max1:
			max_appears += 1
			if max_appears == 2:
				print(max1 * m)
				return
	for ele in v:
		if ele != max1:
			if ele >= max2:
				max2 = ele
	block_size = k + 1
	num_of_blocks = m // block_size
	remainder = m % block_size
	value = num_of_blocks * (k * max1 + max2) + remainder * max1
	print(value)

def main():
	lines = read_lines(input_type=int)
	n = lines[0][0]
	if n % 4 == 0:
		print(0)
	elif n % 4 == 2:
		print(1)
	elif n % 4 == 1:
		print(1)
	else:
		print(0)
main()


num = int(input())
if num == 0 or num == 1 or num == 2:
	print('1')
elif num == 3:
	print('0')
elif num % 4 == 0 or ((num - 1) % 4 != 0 and (num - 1) % 2 == 0):
	print('0')
else:
	print('1')


m = int(input()) % 4
if m in [0, 3]:
	print(0)
else:
	print(1)


n = int(input())
z = n * (n + 1) // 2
if z % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
s = 0
ev = n // 2
unev = n - ev
if unev % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
if n % 4 == 0 or n in range(3, 2 * 10 ** 9, 4):
	print(0)
else:
	print(1)


T_ON = 0
DEBUG_ON = 0
MOD = 998244353

def solve():
	n = read_int()
	total = n * (n + 1) // 2
	if total % 2:
		print(1)
	else:
		print(0)

def main():
	T = read_int() if T_ON else 1
	for i in range(T):
		solve()

def debug(*xargs):
	if DEBUG_ON:
		print(*xargs)
from collections import *
import math
import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def read_int():
	return int(input())

def read_ints():
	return list(map(int, input().split()))

def print_nums(nums):
	print(' '.join(map(str, nums)))

def YES():
	print('YES')

def Yes():
	print('Yes')

def NO():
	print('NO')

def No():
	print('No')

def First():
	print('First')

def Second():
	print('Second')

def fib(n):
	(a, b) = (0, 1)
	for _ in range(n):
		(a, b) = (b, a + b)
	return a

def fib_ns(n):
	assert n >= 1
	f = [0 for _ in range(n + 1)]
	f[0] = 0
	f[1] = 1
	for i in range(2, n + 1):
		f[i] = f[i - 1] + f[i - 2]
	return f

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def xgcd(a, b):
	(x0, x1, y0, y1) = (0, 1, 1, 0)
	while a != 0:
		((q, a), b) = (divmod(b, a), a)
		(y0, y1) = (y1, y0 - q * y1)
		(x0, x1) = (x1, x0 - q * x1)
	return (b, x0, y0)

def lcm(a, b):
	d = gcd(a, b)
	return a * b // d

def modinv(a, m):
	(g, x, _) = xgcd(a, m)
	if g != 1:
		raise Exception('gcd(a, m) != 1')
	return x % m

def mod_add(x, y):
	x += y
	while x >= MOD:
		x -= MOD
	while x < 0:
		x += MOD
	return x

def mod_mul(x, y):
	return x * y % MOD

def mod_pow(x, y):
	if y == 0:
		return 1
	if y % 2:
		return mod_mul(x, mod_pow(x, y - 1))
	p = mod_pow(x, y // 2)
	return mod_mul(p, p)

def mod_inv(y):
	return mod_pow(y, MOD - 2)

def mod_div(x, y):
	return mod_mul(x, mod_inv(y))

def is_prime(n):
	if n == 1:
		return False
	for i in range(2, int(n ** 0.5) + 1):
		if n % i:
			return False
	return True

def gen_primes(n):
	P = [True for _ in range(n + 1)]
	P[0] = P[1] = False
	for i in range(int(n ** 0.5) + 1):
		if P[i]:
			for j in range(2 * i, n + 1, i):
				P[j] = False
	return P
main()


print((int(input()) + 1 & 3) // 2)


if 1 <= int(input()) % 4 <= 2:
	print(1)
else:
	print(0)


import sys
import math
import collections
import operator as op
from collections import deque
from math import gcd, inf, sqrt
from bisect import bisect_right, bisect_left
from functools import reduce
from sys import stdin, stdout, setrecursionlimit
setrecursionlimit(2 ** 20)

def factorial(n):
	if n == 0:
		return 1
	return n * factorial(n - 1)

def ncr(n, r):
	r = min(r, n - r)
	numer = reduce(op.mul, range(n, n - r, -1), 1)
	denom = reduce(op.mul, range(1, r + 1), 1)
	return numer // denom

def prime_factors(n):
	i = 2
	factors = []
	while i * i <= n:
		if n % i:
			i += 1
		else:
			n //= i
			factors.append(i)
	if n > 1:
		factors.append(n)
	return len(set(factors))

def isPowerOfTwo(x):
	return x and (not x & x - 1)

def factors(n):
	return list(set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0))))

def construct(n):
	res = 0
	if n < 8:
		return n
	n -= 8
	res += n % 9
	n -= n % 9
	while n:
		res *= 10
		res += min(n, 9)
		n -= min(n, 9)
	res = res * 10 + 8
	return res
MOD = 10 ** 9 + 7
T = 1
for _ in range(T):
	n = int(stdin.readline())
	ans = n * (n + 1) // 2
	if ans % 2 == 0:
		print(0)
	else:
		print(1)


n = int(input())
if n % 4 >= 1 and n % 4 <= 2:
	print(1)
else:
	print(0)


(z, w, m) = (input, int, sorted)
n = int(z())
print((n + 1) // 2 % 2)


num = int(input())
print(num * (num + 1) // 2 & 1)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	n = int(input())
	if n % 4 == 0 or n % 4 == 3:
		print(0)
	else:
		print(1)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


def main():
	n = int(input())
	if n == 1:
		print(1)
	elif n == 2:
		print(1)
	elif n == 3:
		print(0)
	else:
		f = n % 4
		if f == 0 or f == 3:
			print(0)
		else:
			print(1)
main()


n = int(input())
d = n % 4
if n < 3:
	print(1)
elif n == 3:
	print(0)
elif n > 3 and d == 0:
	print(0)
elif n > 3 and d == 1:
	print(1)
elif n > 3 and d == 2:
	print(1)
elif n > 3 and d == 3:
	print(0)


a = int(input())
if a == 1:
	print('1')
elif a % 2 == 0:
	if a % 4 == 0:
		print('0')
	else:
		print('1')
elif (a - 1) % 4 == 0:
	print('1')
else:
	print('0')


def mi():
	return map(int, input().split())
n = int(input())
n = n * (n + 1) // 2
print(n % 2)


n = int(input())
res = -1
if n == 1 or n == 2:
	res = 1
elif n == 3:
	res = 0
elif n % 4 == 0:
	res = 0
elif n % 2 == 0 and n != -1:
	res = 1
elif (n - 1) % 4 == 0:
	res = 1
else:
	res = 0
print(res)


def process(n):
	a = n * (n + 1) // 2
	if a % 2 == 0:
		return 0
	else:
		return 1
n = int(input())
print(process(n))


import sys
import math
from functools import reduce
import bisect

def getN():
	return int(input())

def getNM():
	return map(int, input().split())

def getList():
	return list(map(int, input().split()))

def input():
	return sys.stdin.readline().rstrip()

def index(a, x):
	i = bisect.bisect_left(a, x)
	if i != len(a) and a[i] == x:
		return -1
	return i
n = getN()
if n < 3:
	print(1)
elif n % 4 == 0 or n % 4 == 3:
	print(0)
else:
	print(1)


n = int(input())
thesum = n * (n + 1) // 2
if thesum % 2 == 0:
	print(0)
else:
	print(1)


def solve(n):
	if n == 1:
		return 1
	if n % 4 == 0:
		return 0
	if n % 2 == 0:
		return 1
	return n * (n + 1) // 2 % 2
n = int(input())
print(solve(n))


n = int(input())
if n % 2 != 0:
	n = n - 3
if n / 2 % 2 == 0:
	print('0')
else:
	print('1')


n = int(input())
temp = n % 4
op = 0
if temp == 1 or temp == 2:
	op = 1
print(op)


n = int(input())
sumi = n * (n + 1) >> 1
if sumi & 1:
	print(1)
else:
	print(0)


from math import ceil
print([0, 1][ceil(int(input()) / 2) % 2])


from datetime import datetime
import math
n = int(input())
start_time = datetime.now()
if n % 4 == 0:
	print(0)
if (n + 1) % 4 == 0:
	print(0)
if (n + 2) % 4 == 0:
	print(1)
if (n + 3) % 4 == 0:
	print(1)


k = int(input())
if k == 3:
	print(0)
elif k == 2:
	print(1)
elif k % 4 == 0 or k % 4 == 3:
	print(0)
else:
	print(1)


def min_diff(num):
	if num == 0:
		return 0
	if num % 4 == 0 or (num + 1) % 4 == 0:
		return 0
	else:
		return 1

def main():
	n = int(input())
	print(min_diff(n))
main()


import math
from collections import defaultdict
ml = lambda : map(int, input().split())
ll = lambda : list(map(int, input().split()))
ii = lambda : int(input())
ip = lambda : input()
t = ii()
if t * (t + 1) // 2 % 2 == 0:
	print(0)
else:
	print(1)


i = int(input())
print(0 if i * (i + 1) % 4 == 0 else 1)


number = int(input())
if number % 2 != 0:
	number = number + 1
if number // 2 % 2 == 0:
	print('0')
else:
	print('1')


import sys
n = int(sys.stdin.readline().strip())
if n % 4 == 1 or n % 4 == 2:
	print(1)
else:
	print(0)


import math
n = int(input())
if n % 2 == 0:
	k = math.ceil(n / 2) * (1 + n)
else:
	k = math.floor(n / 2) * (n + 1) + math.ceil(n / 2)
print(k % 2)


from sys import stdin, stdout
from math import *
from heapq import *
from collections import *

def main():
	n = int(stdin.readline())
	res = 0
	if n <= 4:
		if n == 3 or n == 4:
			res = 0
		else:
			res = 1
		stdout.write(str(res))
		return 0
	m = n % 4
	if m == 1 or m == 2:
		res = 1
	else:
		res = 0
	stdout.write(str(res))
	return 0
main()


from collections import deque
import math
import os
import random
import re
import sys

def main():
	n = int(input())
	ans = n * (n + 1) // 2
	print(ans % 2)
main()


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def LI_():
	return [int(x) - 1 for x in sys.stdin.readline().split()]

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

def LS():
	return sys.stdin.readline().split()

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def main():
	n = I()
	t = n * (n + 1) // 2
	return t % 2
print(main())


a = int(input())
if a % 4 in (0, 3):
	print(0)
else:
	print(1)


from collections import *
from math import *
n = int(input())
ans = 0
if n & 1:
	n -= 1
	ans = 1
if n % 4 == 2:
	ans += 1
print(ans % 2)


n = int(input())
i = 0
s = n % 4
if s == 1 or s == 2:
	print(1)
elif s == 3 or s == 0:
	print(0)


n = int(input())
if n % 2:
	print(int(n / 2) % 2 ^ 1)
else:
	print(int(n / 2) % 2)


n = int(input())
if n == 1 or n == 2:
	print(1)
elif n % 2 == 0:
	c = n // 2
	if c % 2 == 0:
		print(0)
	else:
		print(1)
else:
	c = n + 1
	c = c // 2
	if c % 2 == 0:
		print(0)
	else:
		print(1)


from bisect import bisect_right as br
from bisect import bisect_left as bl
from collections import defaultdict
from itertools import combinations
import functools
import sys
import math
MAX = sys.maxsize
MAXN = 10 ** 6 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b, x, y):
	return abs(a - x) + abs(b - y)

def numIN():
	return map(int, sys.stdin.readline().strip().split())

def charIN():
	return sys.stdin.readline().strip().split()

def ncr(n, k):
	res = 1
	c = [0] * (k + 1)
	c[0] = 1
	for i in range(1, n + 1):
		for j in range(min(i, k), 0, -1):
			c[j] = (c[j] + c[j - 1]) % MOD
	return c[k]
n = int(input())
x = n * (n + 1) // 2
if x % 2:
	print(1)
else:
	print(0)


from sys import stdin
n = int(input())
sumi = n * (n + 1) // 2
if sumi % 2 == 0:
	print(0)
else:
	print(1)


number = int(input())

def div_int(n):
	(first, second) = (n, n + 1)
	if n % 2 == 0:
		first = n / 2
	else:
		second = (n + 1) / 2
	if first % 2 == 1 and second % 2 == 1:
		return 1
	return 0
print(div_int(number))


n = int(input())
sum_n = n * (n + 1) // 2
if sum_n & 1 == 0:
	print(0)
else:
	print(1)


n = int(input())
if n / 2 == 0:
	k = n / 2 % 2
else:
	n = n - 3
	k = n / 2 % 2
print(int(k))


print(int(int(input()) % 4 not in {3, 0}))


n = int(input())
ans = n * (n + 1) // 2
if ans % 2 == 0:
	print('0')
else:
	print('1')


n = int(input())
total = n * (n + 1) // 2
min = total // 2
k1 = 0
k2 = 1
if min + min == total:
	print(k1)
else:
	print(k2)


import math, sys
input = sys.stdin.readline

def inp():
	return int(input())

def inlt():
	return list(map(int, input().split()))

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return list(map(int, input().split()))
n = inp()
r = int((n - 1) / 2) % 2 == 0
print(int(r))


from sys import stdin, stdout
for _ in range(1):
	n = int(stdin.readline())
	print(n * (n + 1) // 2 & 1)


entrada = str(input())
numero = int(entrada[-2:]) % 4
respuesta = 0
if numero == 1 or numero == 2:
	respuesta = 1
print(respuesta)


import sys
from math import ceil
read = sys.stdin.buffer.readline
mi = lambda : map(int, read().split())
li = lambda : list(mi())
cin = lambda : int(read())
d = {'RR': 'G', 'RG': 'B', 'GR': 'B', 'RB': 'G', 'BR': 'G', 'GG': 'R', 'GB': 'R', 'BG': 'R', 'BB': 'R'}
for _ in range(1):
	n = cin()
	if n % 2 == 0:
		if n // 2 % 2 == 0:
			print(0)
		else:
			print(1)
	else:
		n -= 1
		if n // 2 % 2 == 0:
			print(1)
		else:
			print(0)


def intSeqDiv(n):
	s = n * (n + 1) // 2
	if s % 2 == 0:
		return 0
	return 1
n = int(input())
print(intSeqDiv(n))


n = int(input())
arr = [0, 1, 1, 0]
print(arr[n % 4])


from math import ceil
n = int(input())
t = ceil(n / 2)
print('0' if t % 2 == 0 else '1')


n = int(input())
a = n % 4
b = (n + 1) % 4
if a == 0 or b == 0:
	print('0')
else:
	print('1')


x = int(input())
need = x * (x + 1) // 2
if need % 2 == 1:
	print(1)
else:
	print(0)


n = int(input())
d = n * (n + 1) // 2
if d % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
now = (n - 2) % 2
if n == 1 or n == 2:
	print(1)
elif now:
	if (n - 2) // 2 % 2 == 0:
		print(0)
	else:
		print(1)
elif (n - 2) // 2 % 2 == 0:
	print(1)
else:
	print(0)


import math
import bisect
import itertools
import sys
I = lambda : sys.stdin.readline()
mod = 10 ** 9 + 7

def mindiff(a):
	b = a[:]
	b.sort()
	m = 10000000000
	for i in range(len(b) - 1):
		if b[i + 1] - b[i] < m:
			m = b[i + 1] - b[i]
	return m

def lcm(a, b):
	return a * b // math.gcd(a, b)

def merge(a, b):
	i = 0
	j = 0
	c = 0
	ans = []
	while i < len(a) and j < len(b):
		if a[i] < b[j]:
			ans.append(a[i])
			i += 1
		else:
			ans.append(b[j])
			c += len(a) - i
			j += 1
	ans += a[i:]
	ans += b[j:]
	return (ans, c)

def mergesort(a):
	if len(a) == 1:
		return (a, 0)
	mid = len(a) // 2
	(left, left_inversion) = mergesort(a[:mid])
	(right, right_inversion) = mergesort(a[mid:])
	(m, c) = merge(left, right)
	c += left_inversion + right_inversion
	return (m, c)

def is_prime(num):
	if num == 1:
		return False
	if num == 2:
		return True
	if num == 3:
		return True
	if num % 2 == 0:
		return False
	if num % 3 == 0:
		return False
	t = 5
	a = 2
	while t <= int(math.sqrt(num)):
		if num % t == 0:
			return False
		t += a
		a = 6 - a
	return True

def ceil(a, b):
	if a % b == 0:
		return a // b
	else:
		return a // b + 1

def binsearch(arr, b, low, high):
	if low == high:
		return low
	if arr[math.ceil((low + high) / 2)] < b:
		return binsearch(arr, b, low, math.ceil((low + high) / 2) - 1)
	else:
		return binsearch(arr, b, math.ceil((low + high) / 2), high)

def ncr1(n, r):
	s = 1
	for i in range(min(n - r, r)):
		s *= n - i
		s %= mod
		s *= pow(i + 1, mod - 2, mod)
		s %= mod
	return s

def calc(n, m, r):
	s = 0
	for i in range(0, r + 1, 2):
		s += ncr1(n, i) * ncr1(m, i)
		s %= mod
	return s
n = int(input())
if n == 1 or n == 2:
	print(1)
elif n == 3:
	print(0)
elif n % 4 == 0 or n % 4 == 3:
	print(0)
else:
	print(1)


a = int(input())
x = a % 4
if x is 0 or x is 3:
	print('0')
else:
	print('1')


import sys
inp = sys.stdin.readline()
inp = inp.rstrip('\n')
n = int(inp)
res = (n ** 2 + n) // 2
res = res % 2
res = int(res)
print(res)


n = int(input())
if n % 2 == 0:
	co = n // 2
	if co % 2 == 0:
		print(0)
	else:
		print(1)
else:
	co = n // 2
	if co % 2 == 0:
		print(1)
	else:
		print(0)


n = int(input())
SUM = n * (n + 1) // 2
if SUM % 2 == 1:
	print(1)
else:
	print(0)


def solve(rem_tests):
	if not rem_tests:
		return
	n = int(input())
	print(int((n + 1) // 2 & 1))
	solve(rem_tests - 1)
solve(1)


X = int(input())
if X % 2 == 0:
	print(0 if X // 2 % 2 == 0 else 1)
	exit()
print(1 if X // 2 % 2 == 0 else 0)


n = int(input())
sum = 0
if n > 4:
	if (n - 1) % 4 == 0 or (n - 2) % 4 == 0:
		print(1)
	else:
		print(0)
elif n <= 4 and n > 1:
	for i in range(1, n + 1):
		sum = sum + i
	if sum % 2 == 0:
		print(0)
	else:
		print(1)
elif n == 1:
	print(1)


t = int(input())
l = t * (t + 1) // 2
print(l % 2)


a = int(input())
print((a * a + a) // 2 % 2)


import math
n = int(input())
print(math.ceil(n / 2) % 2)


n = int(input())
e = n * (n + 1) // 2
print(0 if e % 2 == 0 else 1)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	n = I()
	x = (1 + n) * n // 2
	if x % 2 == 1:
		return 1
	return 0
print(main())


import math

def ans(a):
	f = a * (a + 1) // 2
	f2 = a * (a + 1) // 4
	if (a % 4 == 0 or a % 4 == 3) or a % 2 == 3:
		print(0)
	else:
		print(1)
t = int(input())
ans(t)


from math import ceil, floor, sqrt
n = int(input())
if n % 4 == 0 or n % 4 == 3:
	print(0)
else:
	print(1)


from sys import stdin

def ii():
	return int(stdin.readline())

def mi():
	return map(int, stdin.readline().split())

def li():
	return list(mi())

def si():
	return stdin.readline()
n = ii()
print(n * (n + 1) // 2 % 2)


import math
from collections import *
import sys
from functools import reduce

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def get_string():
	return list(input().strip().split())

def printxsp(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')
DIRECTIONS = [[0, 1], [0, -1], [1, 0], [1, -1]]
NEIGHBOURS = [(i, j) for i in range(-1, 2) for j in range(-1, 2) if i != 0 or j != 0]
OrdUnicode_a = ord('a')
OrdUnicode_A = ord('A')
CAPS_ALPHABETS = {chr(i + OrdUnicode_A): i for i in range(26)}
SMOL_ALPHABETS = {chr(i + OrdUnicode_a): i for i in range(26)}
UGLYMOD = int(1000000000.0) + 7
SEXYMOD = 998244353
MAXN = int(100000.0) + 1
n = int(input())
print('0' if not n * (n + 1) % 4 else '1')


print('1' if int(input()) % 4 % 3 != 0 else '0')


amount = int(input())
if amount % 4 == 0:
	print(0)
elif amount % 4 == 1:
	print(1)
elif amount % 4 == 2:
	print(1)
else:
	print(0)


def ia():
	n = input().split()
	return list(map(int, n))

def ic():
	return input().split()

def ii():
	return int(input())
n = ii()
s = n % 4
if s == 1 or s == 2:
	print(1)
else:
	print(0)


import sys

def fprint(x):
	print(x, flush=True)

def qprint(x):
	sys.stdout.write(str(x) + '\n')

def input():
	return sys.stdin.readline()
n = int(input())
sum = n * (n + 1) // 2
if sum % 2 != 0:
	print('1')
else:
	print('0')


n = int(input())
if n % 2 == 0 and int(n / 2) % 2 == 0 or (n % 2 == 1 and int(n / 2) % 2 == 1):
	print('0')
else:
	print('1')


l = [0, 1, 1, 0]
n = input()
print(l[int(n) % 4])


def func(n):
	if n == 0:
		return 0
	elif n == 1:
		return 1
	elif n == 2:
		return 1
	elif n == 3:
		return 0
	elif n == 4:
		return 0
	else:
		n = n % 4
		return func(n)
n = int(input())
print(func(n))


n = int(input())
ans = 0
if n % 4 == 0:
	ans = 0
elif n % 4 == 1:
	ans = 1
elif n % 4 == 2:
	ans = 1
elif n % 4 == 3:
	ans = 0
print(ans)


def solve(n):
	s = (1 + n) * n // 2
	return 1 if s & 1 else 0

def main():
	n = int(input())
	print(solve(n))
main()


from sys import stdin, stdout
import cProfile, math
from collections import Counter
from bisect import bisect_left, bisect, bisect_right
import itertools
from copy import deepcopy
from fractions import Fraction
import sys, threading
sys.setrecursionlimit(10 ** 6)
threading.stack_size(2 ** 27)
printHeap = str()
memory_constrained = False
P = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10000000)

class Operation:

	def __init__(self, name, function, function_on_equal, neutral_value=0):
		self.name = name
		self.f = function
		self.f_on_equal = function_on_equal

def add_multiple(x, count):
	return x * count

def min_multiple(x, count):
	return x

def max_multiple(x, count):
	return x
sum_operation = Operation('sum', sum, add_multiple, 0)
min_operation = Operation('min', min, min_multiple, 1000000000.0)
max_operation = Operation('max', max, max_multiple, -1000000000.0)

class SegmentTree:

	def __init__(self, array, operations=[sum_operation, min_operation, max_operation]):
		self.array = array
		if type(operations) != list:
			raise TypeError('operations must be a list')
		self.operations = {}
		for op in operations:
			self.operations[op.name] = op
		self.root = SegmentTreeNode(0, len(array) - 1, self)

	def query(self, start, end, operation_name):
		if self.operations.get(operation_name) == None:
			raise Exception('This operation is not available')
		return self.root._query(start, end, self.operations[operation_name])

	def summary(self):
		return self.root.values

	def update(self, position, value):
		self.root._update(position, value)

	def update_range(self, start, end, value):
		self.root._update_range(start, end, value)

	def __repr__(self):
		return self.root.__repr__()

class SegmentTreeNode:

	def __init__(self, start, end, segment_tree):
		self.range = (start, end)
		self.parent_tree = segment_tree
		self.range_value = None
		self.values = {}
		self.left = None
		self.right = None
		if start == end:
			self._sync()
			return
		self.left = SegmentTreeNode(start, start + (end - start) // 2, segment_tree)
		self.right = SegmentTreeNode(start + (end - start) // 2 + 1, end, segment_tree)
		self._sync()

	def _query(self, start, end, operation):
		if end < self.range[0] or start > self.range[1]:
			return None
		if start <= self.range[0] and self.range[1] <= end:
			return self.values[operation.name]
		self._push()
		left_res = self.left._query(start, end, operation) if self.left else None
		right_res = self.right._query(start, end, operation) if self.right else None
		if left_res is None:
			return right_res
		if right_res is None:
			return left_res
		return operation.f([left_res, right_res])

	def _update(self, position, value):
		if position < self.range[0] or position > self.range[1]:
			return
		if position == self.range[0] and self.range[1] == position:
			self.parent_tree.array[position] = value
			self._sync()
			return
		self._push()
		self.left._update(position, value)
		self.right._update(position, value)
		self._sync()

	def _update_range(self, start, end, value):
		if end < self.range[0] or start > self.range[1]:
			return
		if start <= self.range[0] and self.range[1] <= end:
			self.range_value = value
			self._sync()
			return
		self._push()
		self.left._update_range(start, end, value)
		self.right._update_range(start, end, value)
		self._sync()

	def _sync(self):
		if self.range[0] == self.range[1]:
			for op in self.parent_tree.operations.values():
				current_value = self.parent_tree.array[self.range[0]]
				if self.range_value is not None:
					current_value = self.range_value
				self.values[op.name] = op.f([current_value])
		else:
			for op in self.parent_tree.operations.values():
				result = op.f([self.left.values[op.name], self.right.values[op.name]])
				if self.range_value is not None:
					bound_length = self.range[1] - self.range[0] + 1
					result = op.f_on_equal(self.range_value, bound_length)
				self.values[op.name] = result

	def _push(self):
		if self.range_value is None:
			return
		if self.left:
			self.left.range_value = self.range_value
			self.right.range_value = self.range_value
			self.left._sync()
			self.right._sync()
			self.range_value = None

	def __repr__(self):
		ans = '({}, {}): {}\n'.format(self.range[0], self.range[1], self.values)
		if self.left:
			ans += self.left.__repr__()
		if self.right:
			ans += self.right.__repr__()
		return ans

def display(string_to_print):
	stdout.write(str(string_to_print) + '\n')

def primeFactors(n):
	factors = dict()
	for i in range(2, math.ceil(math.sqrt(n)) + 1):
		while n % i == 0:
			if i in factors:
				factors[i] += 1
			else:
				factors[i] = 1
			n = n // i
	if n > 2:
		factors[n] = 1
	return factors

def isprime(n):
	if n < 4:
		return True
	if n % 2 == 0:
		return False
	if n % 3 == 0:
		return False
	i = 5
	w = 2
	while i * i <= n:
		if n % i == 0:
			return False
		i += w
		w = 6 - w
	return True

def test_print(*args):
	if testingMode:
		print(args)

def display_list(list1, sep=' '):
	stdout.write(sep.join(map(str, list1)) + '\n')

def get_int():
	return int(stdin.readline().strip())

def get_tuple():
	return map(int, stdin.readline().split())

def get_list():
	return list(map(int, stdin.readline().split()))
memory = dict()

def clear_cache():
	global memory
	memory = dict()

def cached_fn(fn, *args):
	global memory
	if args in memory:
		return memory[args]
	else:
		result = fn(*args)
		memory[args] = result
		return result
TestCases = False
testingMode = False
optimiseForReccursion = False

def is_Valid(a, b):
	x = min(a, b)
	y = max(a, b)
	diff = y - x
	y = y - 2 * diff
	x = x - 1 * diff
	if x >= 0 and y >= 0 and (x % 3 == 0) and (y % 3 == 0):
		return True
	return False

def main():
	n = get_int()
	if n * (n + 1) // 2 % 2 == 0:
		print(0)
	else:
		print(1)
if TestCases:
	for _ in range(get_int()):
		cProfile.run('main()') if testingMode else main()
else:
	(cProfile.run('main()') if testingMode else main()) if not optimiseForReccursion else threading.Thread(target=main).start()


import sys
import math
import bisect

def main():
	n = int(input())
	n %= 4
	if n == 0:
		print(0)
	elif n == 3:
		print(0)
	elif n == 2:
		print(1)
	elif n == 1:
		print(1)
main()


s = int(input())
if s % 2 == 0:
	grp = s // 2
	if grp % 2 == 0:
		print(0)
	else:
		print(1)
else:
	grp = (s - 1) // 2
	if grp % 2 != 0:
		print(0)
	else:
		print(1)


import math
a = int(input())
if a % 2 == 0:
	if a // 2 % 2 == 0:
		print(0)
	else:
		print(1)
elif math.ceil(a / 2) % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
b = n * (n + 1) // 2
if b % 2 == 0:
	print('0')
else:
	print('1')


n = int(input())

def find(n):
	if n == 1:
		return 1
	if n == 3:
		return 0
	if n % 4 == 0:
		return 0
	elif n % 2 == 0:
		return 1
	if (n - 1) % 4 == 0:
		return 1
	elif (n - 1) % 2 == 0:
		return 0
print(find(n))


n = int(input())
gauss_sum = n * (n + 1) // 2
half = gauss_sum // 2
print(int(gauss_sum - half * 2))


n = int(input())
if n % 2 != 0:
	v = int((n - 1) / 2)
	if v % 2 != 0:
		print(0)
	elif v % 2 == 0:
		print(1)
elif n % 2 == 0:
	g = int(n / 2)
	if g % 2 != 0:
		print(1)
	elif g % 2 == 0:
		print(0)


n = int(input())
if n % 8 == 0:
	ans = 0
elif n % 8 == 1:
	ans = 1
elif n % 8 == 2:
	ans = 1
elif n % 8 == 3:
	ans = 0
elif n % 8 == 4:
	ans = 0
elif n % 8 == 5:
	ans = 1
elif n % 8 == 6:
	ans = 1
else:
	ans = 0
print(ans)


def f1(n):
	num = '%.2d' % n
	last_digit = int(num[-1])
	penult_digit = int(num[-2])
	if penult_digit % 2 == 0:
		if last_digit == 0:
			return 0
		elif last_digit == 3:
			return 0
		elif last_digit == 4:
			return 0
		elif last_digit == 7:
			return 0
		elif last_digit == 8:
			return 0
		return 1
	else:
		if last_digit == 1:
			return 0
		elif last_digit == 2:
			return 0
		elif last_digit == 5:
			return 0
		elif last_digit == 6:
			return 0
		elif last_digit == 9:
			return 0
		return 1
try:
	n = int(input())
	b = f1(n)
	print(b)
except:
	print('Enter an integer')


n = int(input())
if n % 2 == 1:
	n = n - 3
n = int(n / 2)
print(n % 2)


n = int(input())
v = [0, 1, 1, 0]
print(v[n % 4])


a = int(input())
if a % 4 <= 2 and a % 4 > 0:
	print(1)
else:
	print(0)


n = int(input())
s = 0
if n % 2 != 0 and n / 4 == 0:
	s += 0
elif n % 4 == 1 and n % 2 != 0:
	s += 1
elif n % 2 == 0 and n % 4 == 2:
	s += 1
elif n % 2 == 0 and n % 4 == 0:
	s += 0
print(s)


n = int(input())
if n % 4 > 0 and n % 4 < 3:
	print(1)
else:
	print(0)


x = int(input())
num = (1 + x) * x // 2
if num % 2 == 1:
	print(1)
else:
	print(0)


i = int(input())
s = (1 + i) * i
s = s // 2
if s % 2 == 1:
	print(1)
else:
	print(0)


n = int(input())
print(min(1, n * (n + 1) % 4))


a = int(input())
b = a % 4
if b == 1 or b == 2:
	print(1)
else:
	print(0)


n = int(input())
xx = n * (n + 1) // 2
if xx % 2 == 0:
	print(0)
else:
	print(1)


import sys
inf = float('inf')
mod = 1000000007

def get_array():
	return list(map(int, sys.stdin.readline().split()))

def get_ints():
	return map(int, sys.stdin.readline().split())

def input():
	return sys.stdin.readline()

def main():
	n = int(input())
	sum = n * (n + 1) // 2
	print(0) if sum % 2 == 0 else print(1)
main()


n = int(input())
p = n * (n + 1) // 2
if p % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
if n is 1:
	print(1)
elif n % 4 == 0:
	print(0)
elif n >= 5 and (n - 5) % 4 == 0:
	print(1)
elif n % 2 == 0:
	print(1)
else:
	print(0)


n = eval(input())
if n % 2 != 0:
	n += 1
if n / 2 % 2 == 0:
	print('0')
else:
	print('1')


q = int(input())
if q % 4 == 0:
	print(0)
elif q % 2 == 0:
	print(1)
elif (q - 1) % 4 == 0:
	print(1)
else:
	print(0)


n = int(input())
if n % 2 == 0:
	l = n / 2
else:
	l = (n + 1) / 2
if l % 2 == 0:
	print('0')
else:
	print('1')


import sys
import math

def read_int():
	return int(input().strip())

def read_int_list():
	return list(map(int, input().strip().split()))

def read_string():
	return input().strip()

def read_string_list(delim=' '):
	return input().strip().split(delim)
n = read_int()
if n & 1:
	n += 1
if n % 4 == 0:
	print(0)
	sys.exit()
print(1)
sys.exit()


import sys
n = int(input())
if n == 0:
	print('0')
	sys.exit(0)
if n % 2 != 0:
	n += 1
l = round(n / 2)
if l % 2 == 1:
	print('1')
else:
	print('0')
pass


is_debug = False
n = int(input())
t = n * (n + 1) // 2
print(f't={t}', end='|') if is_debug else ''
print(f'{t % 2}')


n = int(input())
k = (n - 1) % 4
if k < 2:
	print(1)
else:
	print(0)


n = int(input().strip())
l = n * n + n
if l % 4 == 0:
	print(0)
else:
	print(1)


n = int(input())
num = n * (n + 1)
num //= 2
if num % 2 == 1:
	print(1)
else:
	print(0)


import math
mod = 1000000007
t = int(input())
n = t * (t + 1) // 2
if n % 2 == 0:
	print('0')
else:
	print('1')


def main():
	test = int(input())
	if test % 4 == 3 or test % 4 == 0:
		print(0)
	else:
		print(1)
main()


from sys import stdin
n = int(stdin.readline())
s = n * (n + 1) // 2
print(s % 2)


n = int(input())
s = 0
t = n + 1
l = n // 2
if n % 2 == 0:
	s = t * l
else:
	s = t * l + l + 1
if s % 2 == 0:
	print(0)
else:
	print(1)


n = str(input())
num = int(n)
if n[len(n) - 1] == '1' or n[len(n) - 1] == '2' or n[len(n) - 1] == '5' or (n[len(n) - 1] == '6') or (n[len(n) - 1] == '9'):
	if int(num / 10) % 2 == 0:
		print('1\n')
	else:
		print('0\n')
elif int(num / 10) % 2 == 0:
	print('0\n')
else:
	print('1\n')


import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 5)

def li():
	return map(int, stdin.readline().split())

def li_():
	return map(lambda x: int(x) - 1, stdin.readline().split())

def lf():
	return map(float, stdin.readline().split())

def ls():
	return stdin.readline().split()

def ns():
	return stdin.readline().rstrip()

def lc():
	return list(ns())

def ni():
	return int(stdin.readline())

def nf():
	return float(stdin.readline())
n = ni()
print(1) if n * (n + 1) // 2 % 2 else print(0)


x = int(input())
if x % 2 == 0:
	if x % 4 == 0:
		print(0)
	else:
		print(1)
elif (x - 1) % 2 == 0:
	if (x - 1) // 2 % 2 == 0:
		print(1)
	else:
		print(0)


n = int(input())
n = n * (n + 1) // 2
if not n % 2:
	print(0)
else:
	print(1)


results = [0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0, 1, 1, 0, 0]

def solve(n):
	if n < 20:
		return results[max(0, n)]
	return results[n % 20]
n = int(input())
print(solve(n))


n = int(input())
sn = n * (2 + (n - 1) * 1) // 2
if sn % 2 == 0:
	print(0)
else:
	print(1)


n = int(input())
An = 1 + (n - 1)
Sn = n * (1 + An) // 2
print(Sn % 2)


def ans(n):
	sum_ = n * (n + 1)
	sum_ = sum_ // 2
	if sum_ % 2:
		return 1
	return 0
n = int(input())
print(ans(n))


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x) + '\n')
n = get_int()
if n % 2 == 0:
	if n // 2 % 2 == 0:
		print(0)
	else:
		print(1)
elif (n - 1) // 2 % 2 == 0:
	print(1)
else:
	print(0)


n = int(input())
nsum = n * (n + 1) // 2
if nsum % 2 == 1:
	print(1)
else:
	print(0)


from math import ceil, floor, gcd
from collections import deque as queue

def decToBin(number, size=64):
	return bin(number)[2:].zfill(size)

def lcm(a, b):
	return a * b // gcd(a, b)

def binarySearch(arr, l, r, x):
	if r >= l:
		mid = l + (r - l) / 2
		if arr[mid] == x:
			return mid
		elif arr[mid] > x:
			return binarySearch(arr, l, mid - 1, x)
		else:
			return binarySearch(arr, mid + 1, r, x)
	else:
		return -1
n = int(input())
if (n + 1) % 4 == 0 or n % 4 == 0:
	print(0)
else:
	print(1)


n = int(input())
if n % 8 == 0:
	print(0)
elif n % 8 == 1:
	print(1)
elif n % 8 == 2:
	print(1)
elif n % 8 == 3:
	print(0)
elif n % 8 == 4:
	print(0)
elif n % 8 == 5:
	print(1)
elif n % 8 == 6:
	print(1)
elif n % 8 == 7:
	print(0)


n = int(input())
z = n % 4
if z == 0 or z == 3:
	print(0)
else:
	print(1)


N = int(input())
s = (1 + N) * N // 2
print(s % 2)


n = int(input())
v = n % 4
if v == 0:
	print(0)
elif v == 1:
	print(1)
elif v == 2:
	print(1)
elif v == 3:
	print(0)