Pasha has a wooden stick of some positive integer length n. He wants to perform exactly three cuts to get four parts of the stick. Each part must have some positive integer length and the sum of these lengths will obviously be n. 

Pasha likes rectangles but hates squares, so he wonders, how many ways are there to split a stick into four parts so that it's possible to form a rectangle using these parts, but is impossible to form a square.

Your task is to help Pasha and count the number of such ways. Two ways to cut the stick are considered distinct if there exists some integer x, such that the number of parts of length x in the first way differ from the number of parts of length x in the second way.


-----Input-----

The first line of the input contains a positive integer n (1 ≤ n ≤ 2·10^9) — the length of Pasha's stick.


-----Output-----

The output should contain a single integer — the number of ways to split Pasha's stick into four parts of positive integer length so that it's possible to make a rectangle by connecting the ends of these parts, but is impossible to form a square. 


-----Examples-----
Input
6

Output
1

Input
20

Output
4



-----Note-----

There is only one way to divide the stick in the first sample {1, 1, 2, 2}.

Four ways to divide the stick in the second sample are {1, 1, 9, 9}, {2, 2, 8, 8}, {3, 3, 7, 7} and {4, 4, 6, 6}. Note that {5, 5, 5, 5} doesn't work.

Source: codeforces | Difficulty: EASY
Tags: Combinatorics

Mathematics


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


def cut_sticks():
	length = int(input())
	if length % 2 != 0:
		print(0)
		return
	minimum = 1
	counter = 0
	while True:
		if minimum * 2 > length / 2:
			print(counter)
			return
		temp = int(length - minimum * 2)
		if int(temp / 2) == minimum:
			print(counter)
			return
		else:
			minimum += 1
			counter += 1

def cut():
	length = int(input())
	if length % 2 != 0 or length < 6:
		print(0)
		return
	elif length % 4 == 0:
		print(int(length / 4) - 1)
	else:
		print(int(length / 4))
cut()


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


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


n = int(input())
if n & 1:
	print(0)
else:
	ans = n >> 2
	if n & 3 == 0:
		ans -= 1
	print(ans)


n = int(input())
if n % 2:
	print(0)
elif n < 6:
	print(0)
else:
	largest = (n - 2) // 2
	count = (largest - 1) // 2
	if n // 2 % 2:
		count += 1
	print(count)


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


n = int(input())
if n < 6 or n % 2 == 1:
	print(0)
elif n % 2 == 0:
	n1 = n // 2
	n2 = n1 // 2
	if n1 % 2 == 0:
		print(n2 - 1)
	else:
		print(n2)


import math
import sys
n = int(input())
m = int((n - 1) / 2)
k = int(m / 2)
if n % 2 == 1:
	k = 0
print(k)


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


x = int(input())
if x % 2 == 0 and x >= 6:
	if x % 2 % 2 == 1:
		print(x // 4)
	else:
		print((x - 1) // 4)
else:
	print('0')


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


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


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


from math import ceil
n = int(input())
if n >= 6 and n % 2 == 0:
	print(ceil(n / 4.0 - 1))
else:
	print(0)


n = int(input())
if n <= 4 or n % 2 != 0:
	print(0)
elif n % 4 == 0 and n > 4:
	print(int(n // 4) - 1)
else:
	print(n // 2 - 2 - n // 4 + 1)


import os
import sys
from io import BytesIO, IOBase

def main():
	n = int(input())
	if n % 2:
		print(0)
	elif n % 4 == 0:
		print(n // 4 - 1)
	else:
		print(n // 4)
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')
main()


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


x = int(input())
print((x % 2 == 0) * ((x // 2 - 1) // 2))


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


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


n = int(input())
if n & 1 != 0:
	print(0)
elif n % 4 == 0:
	print(n // 4 - 1)
else:
	print(n // 4)


import math
n = int(input())
print([math.ceil(n / 4) - 1, 0][n % 2 != 0])


x = int(input())
print((x // 2 - 1) // 2 * 1 if x % 2 == 0 else 0)


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


n = int(input())
print((1 - n & 1) * (n // 4 - (n % 4 == 0)))


inputVa = int(input())
ans = 0
if inputVa > 3:
	if inputVa % 2 == 0:
		ans = inputVa // 4
		if ans * 4 == inputVa:
			ans = ans - 1
	else:
		ans = 0
print(ans)


n = int(input())
k = 0
t = n // 4
i = 1
if n % 2 == 0:
	while i <= t and i * 4 != n:
		i += 1
		k += 1
	print(k)
else:
	print(0)


from math import *

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

def cins():
	return input.split()

def cino(test=False):
	if not test:
		return int(input())
	else:
		return input()

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

def ssplit():
	return list(input().split())

def printlist(l):
	for i in l:
		print(i, end=' ')

def main():
	n = cino()
	if n < 6 or n & 1:
		print(0)
	else:
		print(n // 4 - (n % 4 == 0))
main()


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


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


import sys
n = int(input())
if n % 2 == 1:
	print(0)
	sys.exit()
n = n // 2
m = 0
if n % 2 == 0:
	m = 1
print(n // 2 - m)


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


def stickProb():
	stickSize = int(input())
	count = 0
	duplicates = 1
	if stickSize >= 12:
		duplicates = 2
	if stickSize % 2 != 0 or int(stickSize / 2 - 2) <= 0:
		print(0)
	elif (stickSize / 2 - 2) % 2 == 0:
		print(int((stickSize / 2 - 2) / 2))
	else:
		print(int((stickSize / 2 - 2) / 2) + 1)
stickProb()


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


n = int(input())
i = 1
j = n // 4
c = 0
if n % 2 != 0:
	c = 0
elif n % 4 == 0:
	c = n // 4 - 1
else:
	c = n // 4
print(c)


a = int(input())
if a % 2:
	print(0)
else:
	print((a // 2 - 1) // 2)


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


import math
n = int(input())
if n < 6 or n % 2 == 1:
	print(0)
else:
	k = n // 2
	if k % 2 == 0:
		print(k // 2 - 1)
	else:
		print(k // 2)


n = int(input())
number_of_ways = 0
if n > 4 and n % 2 == 0:
	if n % 4 == 0:
		print(int(n / 4) - 1)
	else:
		print(int(n / 4))
else:
	print('0')


import math
n = int(input())
if n % 2 == 1:
	print(0)
elif n % 4 == 0:
	print(int(n / 4 - 1))
else:
	print(math.floor(n / 4))


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


from math import ceil
n = int(input())
if n & 1 == 0:
	ans = ceil(n / 4) - 1
else:
	ans = 0
print(ans)


import math
n = int(input())
if n % 2 != 0:
	print(0)
else:
	a = n // 2
	i = 1
	k = a - 1
	print(math.ceil((k - i) / 2))


class CodeforcesTask610ASolution:

	def __init__(self):
		self.result = ''
		self.n = 0

	def read_input(self):
		self.n = int(input())

	def process_task(self):
		if self.n % 2:
			r = 0
		else:
			r = (self.n // 2 - 1) // 2
		self.result = str(r)

	def get_result(self):
		return self.result
Solution = CodeforcesTask610ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


b = int(input())
if b < 6 or b % 2 == 1:
	print(0)
else:
	a = b // 2
	if a % 2 == 0:
		print(a // 2 - 1)
	else:
		print(a // 2)


def solve(n: int) -> int:
	if n % 2 == 1:
		return 0
	elif n % 4 == 0:
		return n // 4 - 1
	else:
		return n // 4
print(solve(int(input())))


n = eval(input())
if n % 2 == 1:
	print(0)
else:
	l = n // 4
	k = l
	if n // 2 % 2 == 0:
		k -= 1
	print(k)


n = int(input())

def fun(n):
	if n % 2 != 0:
		return 0
	(a, b) = divmod(n, 4)
	if b == 0:
		return a - 1
	else:
		return a
print(fun(n))


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


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


n = int(input())

def pasha(n):
	if n % 2 != 0:
		return 0
	m = n // 2
	if m % 2 == 0:
		return max(0, m // 2 - 1)
	else:
		return max(0, m // 2)
assert pasha(13) == 0
assert pasha(12) == 2
assert pasha(14) == 3
assert pasha(16) == 3
print(pasha(n))


import math

def PashaAndSticks(n):
	if n % 2 == 1:
		return 0
	cnt = math.floor(n / 4)
	if n % 4 == 0:
		return cnt - 1
	else:
		return cnt
n = int(input())
print(PashaAndSticks(n))


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


from sys import stdin
from math import ceil

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

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

def linput():
	return list(map(int, stdin.readline().split()))
n = iinput()
print(0 if n & 1 else ceil(n / 4) - 1)


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


import math, string, itertools, fractions, heapq, collections, re, array, bisect
from sys import stdin, stdout
n = int(stdin.readline())

def count(inp):
	if inp % 2 != 0 or inp < 6:
		return 0
	xy = int(inp / 2)
	l = int(math.ceil(xy / 2)) - 1
	return l
ans = count(n)
stdout.write(str(ans) + '\n')


n = int(input())
if n % 2:
	print(0)
else:
	(x, y) = (1, n // 2 - 1)
	c = 0
	if x < y:
		if (y - x + 1) // 2 > 0:
			c = (y - x + 1) // 2
		else:
			c = 1
	print(c)


n = int(input())
if n % 2 == 0:
	a = n / 2
	i = a // 2
	if a % 2 == 0:
		i = i - 1
	print(int(i))
else:
	print(0)


n = int(input())
print([0, n // 4 - (n % 4 == 0)][n % 2 == 0])


from math import *
n = int(input())
if n & 1:
	print('0')
else:
	half = n / 2
	ans = ceil(half / 2) - 1
	if ans < 0:
		print('0')
	else:
		print(ans)


def main():
	n = int(input())
	if n > 6 and n % 2 == 0:
		print(int((n // 2 - 1) / 2))
	elif n == 6:
		print(1)
	else:
		print(0)
main()


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


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


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


a = int(input())
if a % 2 != 0:
	print(0)
elif a <= 4:
	print(0)
else:
	print(a // 4 - (a % 4 == 0))


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


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


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


n = int(input())
if n < 6 or n % 2 != 0:
	print(0)
else:
	print((n - 2) // 4)


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


import math

def solve():
	n = int(input())
	if n & 1:
		print(0)
		return
	print(math.ceil(n / 4 - 1))
solve()


import sys
n = int(input())
if n % 2:
	print(0)
	sys.exit(0)
n = n // 2
if n is 0:
	print(0)
elif n % 2 == 0:
	print(n // 2 - 1)
else:
	print(n // 2)


n = int(input())
if n % 2 != 0:
	print(0)
	exit()
left = 0
right = n
while right - left > 1:
	mid = (right + left) // 2
	left2 = 1
	right2 = n
	while right2 - left2 > 1:
		mid2 = (right2 + left2) // 2
		if mid * 2 + mid2 * 2 <= n:
			left2 = mid2
		else:
			right2 = mid2
	if mid * 2 + left2 * 2 <= n and mid < left2:
		left = mid
	else:
		right = mid
print(left)


N = int(input())
if N % 2 != 0 or N <= 5:
	print('0')
	exit()
ans = (N // 2 - 1) // 2
print(ans)


n = int(input())
print([(n // 2 - 1) // 2, 0][n % 2 == 1])


import sys
N = int(input())
if N % 2 == 1:
	print(0)
	sys.exit()
else:
	N = int(N / 2)
	if N % 2 == 0:
		print(int(N / 2) - 1)
	else:
		print(int(N / 2))


from sys import stdin, stdout
from heapq import heapify, heappush, heappop, heappushpop
from collections import defaultdict as dd, deque as dq, Counter as C
from bisect import bisect_left as bl, bisect_right as br
from itertools import combinations as cmb, permutations as pmb
from math import factorial as f, ceil, gcd, sqrt, log, inf
mi = lambda : map(int, input().split())
ii = lambda : int(input())
li = lambda : list(map(int, input().split()))
mati = lambda r: [li() for _ in range(r)]
lcm = lambda a, b: a * b // gcd(a, b)
MOD = 10 ** 9 + 7

def soe(n):
	prime = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if prime[p] == True:
			for i in range(p * p, n + 1, p):
				prime[i] = False
		p += 1
	return prime

def ncr(n, r):
	(p, k) = (1, 1)
	if n - r < r:
		r = n - r
	if r != 0:
		while r:
			(p, k) = (p * n, k * r)
			m = gcd(p, k)
			(p, k) = (p // m, k // m)
			(n, r) = (n - 1, r - 1)
	else:
		p = 1
	return p

def solve():
	n = ii()
	if n % 2 == 0:
		print(ceil(ceil(n / 2) / 2) - 1)
	else:
		print(0)
for _ in range(1):
	solve()


def ans(n):
	if n % 2 == 1 or n <= 4:
		return 0
	else:
		rect = 0
		h = 0
		while h < n:
			h += 2
			n -= 2
			rect += 1
		return rect - 1
n = int(input())
print(ans(n))


import logging
import copy
import sys
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(firstLine):
	n = firstLine[0]
	result = [1, 1, 1, 1]
	if n <= 4:
		return 0
	if n % 2 != 0:
		return 0
	an = int(int(n / 2) / 2)
	if n % 4 == 0:
		an -= 1
	return an

def main():
	firstLine = input().split()
	firstLine = list(map(int, firstLine))
	print(solve(firstLine))

def log(*message):
	logging.debug(*message)
main()


n = int(input())
print(((n + 3) // 4 - 1) * (n % 2 == 0))


import sys
N = int(input())

def ans(N):
	if N % 2 == 1:
		return 0
	half = N / 2
	if half % 2 == 0:
		return int(half / 2 - 1)
	if half % 2 == 1:
		return int((half - 1) / 2)
print(ans(N))


import sys
from math import *

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
n = mint()
if n % 2 != 0:
	print(0)
else:
	n //= 2
	x = n // 2 - 1
	while x + 1 < n - (x + 1):
		x += 1
	if x < 0:
		print(0)
	else:
		print(x)


n = int(input())
if n % 2 == 1:
	print(0)
	exit(0)
t = n // 2
if t % 2 == 0:
	print(t // 2 - 1)
else:
	print(t // 2)


import sys
n = int(sys.stdin.readline())
if n % 2 != 0:
	print(0)
else:
	print((n - 1) // 4)


n = int(input())
if n % 2:
	print(0)
	exit()
print(n // 4 - (n // 2 % 2 == 0))


n = int(input())
if n % 2 == 0 and n >= 6:
	p = n // 2
	if p % 2 == 0:
		print(p // 2 - 1)
	else:
		print(p // 2)
else:
	print(0)


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


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


n = int(input())
from sys import exit
if n % 2 != 0:
	print(0)
	exit()
if n % 4 == 0:
	x = int(n / 4 - 1)
else:
	x = int(n / 4)
print(x)


n = int(input())
if n % 2 != 0:
	print(0)
else:
	q = n // 4
	r = n % 4
	if r == 0:
		print(q - 1)
	else:
		print(q)


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


n = int(input())
if n % 2 != 0:
	print(0)
else:
	k = min(n % 4, 1)
	print(n // 4 - (1 - k))


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


n = int(input())
ans = 0 if n & 1 else n // 4
ans -= 1 if n % 4 == 0 else 0
print(ans)


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


n = int(input())
l = 0
r = n
if n < 6 or n % 2 == 1:
	print(0)
elif n // 2 % 2 == 1:
	print(n // 2 // 2)
else:
	print(n // 2 // 2 - 1)


n = int(input())
if n % 2 == 0:
	if n // 2 % 2 == 0:
		print(max(n // 2 // 2 - 1, 0))
	else:
		print(n // 2 // 2)
else:
	print(0)


def stick(n):
	if n % 2 or n <= 4:
		return 0
	m = n // 2
	return (m - 1) // 2
n = int(input())
print(stick(n))


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


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


n = int(input().strip())
if n % 2 != 0:
	print(0)
elif n % 4 == 0:
	print(n // 4 - 1)
else:
	print(n // 4)


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


n = int(input())
a = n // 2
answer = (a - 1) // 2
if n % 2 == 1:
	answer = 0
print(answer)


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


import sys
inf = float('inf')
abc = 'abcdefghijklmnopqrstuvwxyz'
abd = {'a': 0, 'b': 1, 'c': 2, 'd': 3, 'e': 4, 'f': 5, 'g': 6, 'h': 7, 'i': 8, 'j': 9, 'k': 10, 'l': 11, 'm': 12, 'n': 13, 'o': 14, 'p': 15, 'q': 16, 'r': 17, 's': 18, 't': 19, 'u': 20, 'v': 21, 'w': 22, 'x': 23, 'y': 24, 'z': 25}
(mod, MOD) = (1000000007, 998244353)
vow = ['a', 'e', 'i', 'o', 'u']
(dx, dy) = ([-1, 1, 0, 0], [0, 0, 1, -1])

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

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

def input():
	return sys.stdin.readline().strip()
n = int(input())
if n < 6 or n & 1:
	print(0)
	exit()
z = n // 2
if z & 1:
	print(z // 2)
else:
	print(z // 2 - 1)


def divisible_by(value, n):
	return value % n == 0
length = int(input())
ways = 0
if divisible_by(length, 2):
	ways = length // 4
	if divisible_by(length, 4):
		ways -= 1
print(ways)


q = int(input())
if q > 5:
	if q % 4 == 0 or q % 4 == 2:
		print((q // 2 - 1) // 2)
	else:
		print(0)
else:
	print(0)


from math import ceil
x = int(input())
print(0 if x % 2 else ceil(x / 4) - 1)


N = int(input())
if N & 1 or N < 6:
	print(0)
else:
	N = N // 2
	print(N - N // 2 - 1)


a = int(input())
x = a // 4 - 1
if a % 4 == 1 or a % 4 == 3:
	print(0)
elif a % 4 == 0:
	print(x)
else:
	print(x + 1)


n = int(input())
if n < 6 or n % 2 == 1:
	print(0)
	exit(0)
n = n // 2
print(n // 2 - (1 - n % 2))


__author__ = 'Admin'
n = int(input())
ans = 0
if n % 2 == 0:
	if n // 2 % 2 == 0:
		ans = n // 4 - 1
	else:
		ans = n // 4
else:
	ans = 0
print(ans)


a = int(input())
if a % 2 != 0:
	print(0)
	exit()
print((a // 2 - 1) // 2)


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


import math
alph = 'abcdefghijklmnopqrstuvwxyz'
n = int(input())
if n % 2 == 1:
	print(0)
else:
	print(n // 2 // 2 - 1 * int(n % 4 == 0))


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


import math, sys, re, itertools
(rs, ri, rai) = (input, lambda : int(input()), lambda : list(map(int, input().split())))
n = ri()
if n % 2 != 0:
	print(0)
else:
	n //= 2
	k = n // 2
	if n % 2 == 0:
		k -= 1
	print(k)


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


from math import ceil
n = int(input())
if n < 6 or n % 2:
	print(0)
else:
	a = (n - 2) // 2
	print(ceil((a - 1) / 2))


X = int(input())
if X < 6 or X % 2 != 0:
	print(0)
	exit()
print(X // 4 if X / 4 != X // 4 else X // 4 - 1)


n = int(input())
answer = 0
k = n // 2
if k * 2 == n:
	answer = (k - 1) // 2
print(answer)


n = int(input())
rects = 0
if n % 2 != 0 or n <= 4:
	rects = 0
else:
	a = b = 1
	c = d = int((n - 2) / 2)
	rects = c - int((b + c) / 2)
print(rects)


import sys
import math
import collections
inp = lambda : sys.stdin.readline()
x = int(inp())
if x % 2 != 0:
	print(0)
else:
	x //= 2
	if x % 2 == 0:
		print(x // 2 - 1)
	else:
		print(x // 2)


n = int(input())
cnt = 0
if n % 2 == 1 or n <= 5:
	print(0)
	exit()
a = n // 2 - 2
if a % 2 == 0:
	print(a // 2)
else:
	print((a - 1) // 2 + 1)


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


def STR():
	return list(input())

def INT():
	return int(input())

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

def MAP2():
	return map(float, input().split())

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

def STRING():
	return input()
import string
import sys
from heapq import heappop, heappush
from bisect import *
from collections import deque, Counter, defaultdict
from math import *
from itertools import permutations, accumulate
dx = [-1, 1, 0, 0]
dy = [0, 0, 1, -1]
n = INT()
if n % 2 != 0:
	print('0')
	exit(0)
r = n // 2
r2 = r // 2
if r % 2 == 0:
	print(r2 - 1)
else:
	print(r2)


n = int(input())
ans = 0
if n % 2 == 0:
	half = n >> 1
	if half % 2 == 0:
		ans = (half >> 1) - 1
	else:
		ans = half - 1 >> 1
print(ans)


n = float(input())
if n <= 4:
	print('0')
elif n % 2 != 0:
	print('0')
else:
	n = (n / 2 - 2) / 2
	if n % 1 == 0.5:
		n += 0.5
	print(int(n))


from sys import stdin as Si
from math import floor as F
from collections import defaultdict as dt
from operator import itemgetter as ig
n = int(Si.readline())
if n % 2 != 0:
	print(0)
else:
	n /= 2
	if n % 2 == 0:
		print(F((n - 1) / 2))
	else:
		print(F(n / 2))


import math
l = int(input())
if l & 1:
	print(0)
elif l % 4 is 0:
	l = l / 4
	print(int(l - 1))
else:
	print(int(l / 4))


n = int(input()) - 2
if n % 2 != 0:
	print(0)
else:
	no = n // 4
	print(no)


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


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


__author__ = 'Utena'
n = int(input())
if n % 2 == 1:
	print(0)
elif n % 4 == 0:
	print((n - 1) // 4)
else:
	print(n // 4)


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


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


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


n = int(input())
if n % 2 != 0 or n <= 4:
	print('0')
else:
	half = n // 2 - 1
	quart = n // 4
	print(half - quart)


from collections import defaultdict
import math
x = int(input())
if x % 2 != 0:
	ans = 0
else:
	ans = (x // 2 - 1) // 2
print(ans)


n = int(input())
if n % 2 == 1:
	print(0)
else:
	val = n // 2
	f = 0
	if val % 2 == 0:
		f = 1
	ans = val // 2
	if f == 1:
		ans = ans - 1
	print(ans)


n = int(input())
if n < 6 or n % 2 == 1:
	print(0)
else:
	R = (n - 2) // 2
	print(R // 2)


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


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


import sys
if False:
	inp = open('A.txt', 'r')
else:
	inp = sys.stdin
n = int(inp.readline())
ans = 0
if n % 2 != 0:
	print(0)
elif n % 4 == 0:
	print(n // 4 - 1)
else:
	print(n // 4)


from math import sqrt
n = int(input())
if 1 <= n <= 2 * pow(10, 9):
	if n % 2 == 1:
		print('0')
	else:
		half = n / 2
		if half % 2 == 0:
			print(int(half / 2 - 1))
		else:
			print(int((half - 1) / 2))


n = int(input())

def fn(n):
	if n % 2 != 0:
		return 0
	else:
		return (n // 2 - 1) // 2
print(fn(n))


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

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

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

def li():
	return [int(i) for i in input().split()]

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

def revn(n):
	return str(n)[::-1]

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=2):
	r = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				r.append(i)
			else:
				r.extend([i, n // i])
	return r

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def convn(number, base):
	new_number = 0
	while number > 0:
		new_number += number % base
		number //= base
	return new_number

def cdiv(n, k):
	return n // k + (n % k != 0)

def ispal(s):
	for i in range(len(s) // 2 + 1):
		if s[i] != s[-i - 1]:
			return False
	return True
n = ii()
if n % 2 == 0:
	if n % 4 == 0:
		print(n // 4 - 1)
	else:
		print(n // 4)
else:
	print(0)


from math import ceil
n = int(input())
if n < 6:
	print(0)
elif n % 2:
	print(0)
else:
	x = n // 2
	print(ceil(x / 2) - 1)


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


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


def pasha(n):
	if n % 2 != 0:
		return 0
	k = n // 2 // 2
	if n // 2 % 2 == 0:
		k -= 1
	return k
print(pasha(int(input())))


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


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


a = int(input())
b = 0
c = []
if a % 2 != 0:
	print(0)
elif a % 4 == 0:
	print(a // 4 - 1)
else:
	print((a - 2) // 4)


import re, sys, math, string, operator, functools, fractions, collections
sys.setrecursionlimit(10 ** 7)
dX = [-1, 1, 0, 0, -1, 1, -1, 1]
dY = [0, 0, -1, 1, 1, -1, -1, 1]
RI = lambda : list(map(int, input().split()))
RS = lambda : input().rstrip().split()
n = RI()[0]
if n & 1:
	ans = 0
else:
	ans = n // 4 - 1 + (n // 2 & 1)
print(ans)


x = int(input())

def find(n):
	if n % 2 == 1:
		return 0
	y = n / 2
	return int((y - 1) / 2)
print(find(x))


f = lambda : map(int, input().split())
n = int(input())
if n % 2 != 0:
	print(0)
else:
	n //= 2
	print([n // 2 - 1, n // 2][n % 2 != 0])


n = int(input().strip())
if n % 2 == 0:
	n = n // 2
	if n % 2 == 0:
		print(n // 2 - 1)
	else:
		print(n // 2)
else:
	print(0)


import math
n = int(input())
a = 0
b = 1
if n % 2 == 0:
	if n == 2 or n == 4:
		count = 0
	elif n < 10:
		count = 1
	else:
		count = math.ceil(n / 4) - 1
else:
	count = 0
print(count)


from math import *

def main():
	n = int(input())
	if n % 2 != 0:
		print(0)
	else:
		ans = ceil(n / 4 - 1)
		print(ans)
main()


n = int(input())
if n % 2 == 1:
	print(0)
	quit()
print(max(0, n // 4 - (1 if n % 4 == 0 else 0)))


l = int(input())
if l % 2:
	print(0)
else:
	f = l // 4
	r = l == f * 4
	print(f - r)


n = int(input())
if n % 2 or n < 6:
	ans = 0
else:
	ans = n // 4 + int(bool(n % 4)) - 1
print(ans)


def main():
	l = int(input())
	if l % 2 != 0:
		print(0)
	else:
		v = l // 2
		if v % 2 == 0:
			print(v // 2 - 1)
		else:
			print(v // 2)
main()


x = int(input())
print(abs((x // 2 - 1) // 2 * (x % 2 - 1)))


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


import math

def func(n):
	if n % 2 == 1:
		return 0
	return math.ceil(n / 4) - 1
s = int(input())
print(func(s))


from math import ceil as c
n = int(input())
print(0 if n % 2 else c((n - n // 2) / 2) - 1)


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

def solver(n):
	if n % 2 == 1:
		return 0
	else:
		maxWidth = (n - 1) // 4
		return maxWidth
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()
	if n % 2 == 1:
		return 0
	t = n // 2
	return (t - 1) // 2
print(main())


import sys
n = int(input())
if n < 5 or n % 2 != 0:
	print('0')
else:
	d = int(n / 2)
	if d % 2 == 0:
		print(int(d / 2) - 1)
	else:
		print(int(d / 2))


N = int(input())
if N % 2 == 1 or N <= 4:
	print('0')
	exit()
elif N // 2 == 0:
	print(N // 4 - 1)
else:
	N = N // 2
	print((N - 1) // 2)


from math import ceil, sqrt, floor
import sys
n = int(input())
if n % 2:
	print(0)
elif not n % 4:
	print(n // 4 - 1)
else:
	print(n // 4)


n = int(input())
if n < 6 or n % 2 == 1:
	print(0)
else:
	print(n // 2 // 2 - abs(n // 2 % 2 - 1))


from sys import stdin

def r():
	return stdin.readline().strip()

def r_t(tp):
	return map(tp, r().strip().split())

def r_a(tp):
	return list(r_t(tp))

def main():
	n = int(r())
	print(0 if n & 1 else n // 4 - 1 if not n // 2 & 1 else n // 4)
main()


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


k = int(input())
m = k // 2
if k % 2 != 0 or k <= 4:
	print(0)
elif m % 2 == 0:
	print(m // 2 - 1)
else:
	print(m // 2)


a = int(input())
if a < 6:
	print(0)
	exit()
if a % 2 == 0:
	if a % 4 != 0:
		print(a // 4)
		exit()
	else:
		print(a // 4 - 1)
		exit()
print(0)


m = int(input())
if m % 2 == 1 or m == 2 or m == 4:
	print('0')
else:
	print((m - 1) // 4)


n = int(input())
flag = 0
if n % 2 == 1:
	flag = 1
	print(0)
if n < 6 and flag == 0:
	flag = 1
	print(0)
a = n // 2
if a % 2 == 0 and flag == 0:
	print(a // 2 - 1)
elif a % 2 == 1 and flag == 0:
	print(a // 2)


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


import sys
ip = lambda : int(sys.stdin.readline())
arr = lambda : list(map(int, sys.stdin.readline().split(' ')))
arr1 = lambda n: [arr() for _ in range(n)]
n = ip()
if n == 6:
	print(1)
elif n % 4 == 0:
	print(n // 4 - 1)
elif n % 2 == 0:
	print(n // 4)
else:
	print(0)


n = int(input())
c = n // 4
c1 = n % 4
if c1 == 2:
	cnt = c
else:
	cnt = c - 1
print(cnt if cnt >= 0 and n % 2 == 0 else 0)


def main(a):
	if a % 2 == 1:
		return 0
	if a // 2 % 2 == 0:
		return a // 4 - 1
	else:
		return a // 4
print(main(int(input())))


n = int(input())
ans = 0
if n % 2 == 0:
	ans = n // 4
	if n % 4 == 0:
		ans -= 1
print(ans)


length = int(input())
if length & 1:
	print(0)
else:
	limite = length // 2
	print((limite - 1) // 2)


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


from math import factorial, ceil

def newton(n, k):
	return factorial(n) / (factorial(k) * factorial(n - k))
n = int(input())
num = ceil(int(n / 2) / 2) - 1
if num <= 0 or n % 2 == 1:
	print(0)
else:
	print(num)


import math
n = int(input())
if n & 1:
	print('0')
	exit()
res = n / 4
res = int(math.ceil(res))
print(max(res, 0) - 1)


n = int(input())
ans = n // 2 // 2
if n % 2 == 0 and n // 2 % 2 == 0:
	ans -= 1
if n % 2 != 0:
	ans = 0
print(ans)


from math import ceil
n = int(input())
if n % 2 == 1:
	print(0)
else:
	a = 1
	b = (n - 2) // 2
	print(ceil((b - a) / 2))


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


import sys
import math
import bisect
import itertools
import random
import re

def solve(n):
	if n % 2 == 1:
		return 0
	n //= 2
	ans = n // 2
	if n % 2 == 0:
		ans -= 1
	return ans

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


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


from sys import stdin
input = stdin.readline
n = int(input())
if n % 2 > 0:
	print(0)
else:
	print(n // 4 - (n % 4 == 0))


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


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


v = int(input())

def solve(x):
	if x % 2 == 1:
		return 0
	y = x // 2
	y -= 1
	return y // 2
print(solve(v))


n = int(input())
if n % 2:
	print(0)
else:
	print(n // 4 - int(not n % 4))


def PS():
	uOutput = 0
	uInput = int(input())
	if uInput % 2 == 0:
		bQuart = 0
		if uInput % 4 == 0:
			bQuart = 1
		uHalf = uInput // 2
		uOutput = uHalf // 2 - bQuart
	return uOutput
print(PS())


n = int(input())
if n & 1:
	print(0)
else:
	half = n // 2
	flag = 1 if half % 2 == 0 else 0
	print(half // 2 - flag)


import math
x = float(input())
if x % 2 == 0:
	if x / 4 == math.floor(x / 4):
		c = x / 4 - 1
	else:
		c = math.floor(x / 4)
else:
	c = 0
print(int(c))


import itertools
import math
n = int(input())
if n % 2:
	print(0)
else:
	m = n // 2
	print((m - 1) // 2)


import sys

def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)
fast_reader = sys.stdin.readline
fast_writer = sys.stdout.write

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

def print(*argv):
	fast_writer(' '.join((str(i) for i in argv)))
	fast_writer('\n')
n = int(input())
if n % 2 == 1:
	print(0)
else:
	print((n - 1) // 4)


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


n = int(input())
a = n // 4
b = n % 4
if n % 2 == 0 and n // 4 >= 1:
	if b == 2:
		print(a)
	else:
		print(a - 1)
else:
	print(0)


n = int(input())
print(0 if n & 1 else (n + 3) // 4 - 1)


import math

def ncr(n, r):
	f = math.factorial
	return f(n) / f(r) / f(n - r)
n = int(input())
if n % 2 == 0:
	n = n // 2
	if n % 2 == 0:
		n = n - 1
	print(n // 2)
else:
	print(0)


n = int(input())

def even(x):
	if x % 2 == 0:
		return True
	else:
		return False
if even(n):
	print(int((n / 2 - 1) / 2))
else:
	print(0)


from collections import defaultdict, deque, Counter, OrderedDict
from bisect import insort, bisect_right, bisect_left
import threading, sys

def main():
	n = int(input())
	if n % 2 == 0:
		n //= 2
		ans = n // 2
		if n % 2 == 0:
			ans -= 1
	else:
		ans = 0
	print(ans)
thread = threading.Thread(target=main)
thread.start()


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


from sys import stdin
from collections import deque
mod = 10 ** 9 + 7
import sys
sys.setrecursionlimit(10 ** 5)
from queue import PriorityQueue
from bisect import bisect_right
from bisect import bisect_left
from collections import defaultdict
from math import sqrt, factorial, gcd, log2, inf, ceil
import heapq
input = lambda : sys.stdin.readline().rstrip()
from sys import stdin, stdout
from heapq import heapify, heappush, heappop
n = int(input())
if n % 2 == 0:
	if n % 4 == 0:
		print(n // 4 - 1)
	else:
		print(n // 4)
else:
	print(0)


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()
if n % 2:
	p = 0
else:
	p = n // 4
	if not n % 4:
		p -= 1
print(p)


import math
n = int(input())
if n % 2 == 1:
	print(0)
	exit(0)
n /= 4
(ce, fl) = (math.ceil(n), math.floor(n))
print(fl if ce != fl else fl - 1)