Maria participates in a bicycle race.

The speedway takes place on the shores of Lake Lucerne, just repeating its contour. As you know, the lake shore consists only of straight sections, directed to the north, south, east or west.

Let's introduce a system of coordinates, directing the Ox axis from west to east, and the Oy axis from south to north. As a starting position of the race the southernmost point of the track is selected (and if there are several such points, the most western among them). The participants start the race, moving to the north. At all straight sections of the track, the participants travel in one of the four directions (north, south, east or west) and change the direction of movement only in bends between the straight sections. The participants, of course, never turn back, that is, they do not change the direction of movement from north to south or from east to west (or vice versa).

Maria is still young, so she does not feel confident at some turns. Namely, Maria feels insecure if at a failed or untimely turn, she gets into the water. In other words, Maria considers the turn dangerous if she immediately gets into the water if it is ignored.

Help Maria get ready for the competition — determine the number of dangerous turns on the track.


-----Input-----

The first line of the input contains an integer n (4 ≤ n ≤ 1000) — the number of straight sections of the track.

The following (n + 1)-th line contains pairs of integers (x_{i}, y_{i}) ( - 10 000 ≤ x_{i}, y_{i} ≤ 10 000). The first of these points is the starting position. The i-th straight section of the track begins at the point (x_{i}, y_{i}) and ends at the point (x_{i} + 1, y_{i} + 1).

It is guaranteed that:

  the first straight section is directed to the north;  the southernmost (and if there are several, then the most western of among them) point of the track is the first point;  the last point coincides with the first one (i.e., the start position);  any pair of straight sections of the track has no shared points (except for the neighboring ones, they share exactly one point);  no pair of points (except for the first and last one) is the same;  no two adjacent straight sections are directed in the same direction or in opposite directions. 


-----Output-----

Print a single integer — the number of dangerous turns on the track.


-----Examples-----
Input
6
0 0
0 1
1 1
1 2
2 2
2 0
0 0

Output
1

Input
16
1 1
1 5
3 5
3 7
2 7
2 9
6 9
6 7
5 7
5 3
4 3
4 4
3 4
3 2
5 2
5 1
1 1

Output
6



-----Note-----

The first sample corresponds to the picture:

 [Image] 

The picture shows that you can get in the water under unfortunate circumstances only at turn at the point (1, 1). Thus, the answer is 1.

Source: codeforces | Difficulty: MEDIUM
Tags: Mathematics

Geometry

Implementation


Solutions:
n = int(input())
points = []
for _ in range(n):
	(x, y) = map(int, input().split())
	points.append([x, y])
point_count = 0
for i in range(len(points) - 1):
	pre_point = points[i - 1]
	point = points[i]
	next_point = points[i + 1]
	if pre_point[0] == point[0] and next_point[1] == point[1]:
		if point[0] > next_point[0] and point[1] > pre_point[1] or (point[0] < next_point[0] and point[1] < pre_point[1]):
			point_count += 1
	elif next_point[0] == point[0] and pre_point[1] == point[1]:
		if point[0] > pre_point[0] and point[1] < next_point[1] or (point[0] < pre_point[0] and point[1] > next_point[1]):
			point_count += 1
print(point_count)


n = int(input())
for i in range(n):
	input()
print(n // 2 - 2)


n = int(input())
vert = [tuple(map(int, input().split())) for i in range(n + 1)]
turn = [True for i in range(n - 1)]
handed = 0
plus = minus = 0
for i in range(n - 1):
	a1 = (vert[i + 1][0] - vert[i][0], vert[i + 1][1] - vert[i][1])
	a2 = (vert[i + 2][0] - vert[i + 1][0], vert[i + 2][1] - vert[i + 1][1])
	cross = a1[0] * a2[1] - a1[1] * a2[0]
	if cross > 0:
		cross = 1
		plus += 1
		turn.append(1)
	elif cross < 0:
		cross = -1
		minus += 1
		turn.append(-1)
	handed += cross
if handed > 0:
	print(minus)
else:
	print(plus)


n = int(input())
count = 0
points = [tuple(map(int, input().split())), tuple(map(int, input().split()))]
for i in range(2, n + 1):
	(x, y) = map(int, input().split())
	points.append((x, y))
	if points[i - 1][0] < x:
		temp = 'east'
	if points[i - 1][0] > x:
		temp = 'west'
	if points[i - 1][1] < y:
		temp = 'north'
	if points[i - 1][1] > y:
		temp = 'south'
	x = points[i - 1][0]
	y = points[i - 1][1]
	if points[i - 2][0] < x:
		temp1 = 'east'
	if points[i - 2][0] > x:
		temp1 = 'west'
	if points[i - 2][1] < y:
		temp1 = 'north'
	if points[i - 2][1] > y:
		temp1 = 'south'
	if (temp1, temp) in [('north', 'west'), ('west', 'south'), ('south', 'east'), ('east', 'north')]:
		count += 1
print(count)


import os
import sys
from io import BytesIO, IOBase
ii = lambda : int(input())
lmii = lambda : list(map(int, input().split()))
slmii = lambda : sorted(map(int, input().split()))
li = lambda : list(input())
mii = lambda : map(int, input().split())
msi = lambda : map(str, input().split())

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

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

def main():
	n = ii()
	lst = []
	for i in range(n + 1):
		lst.append(lmii())
	d = []
	for i in range(1, n + 1):
		d.append(('U' if lst[i - 1][1] < lst[i][1] else 'D') if lst[i - 1][0] == lst[i][0] else 'R' if lst[i - 1][0] < lst[i][0] else 'L')
	cnt = 0
	ln = len(d)
	for i in range(1, ln):
		cnt += d[i] == 'U' and d[i - 1] in 'R' or (d[i] == 'R' and d[i - 1] == 'D') or (d[i] == 'L' and d[i - 1] == 'U') or (d[i] == 'D' and d[i - 1] == 'L')
	print(cnt)
	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')
main()


from sys import stdin, stdout
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import *
from random import *
from itertools import permutations
input = stdin.readline
prin = stdout.write
from random import sample
from collections import Counter, deque
from fractions import *
from math import sqrt, ceil, log2, gcd, cos, pi, floor
from copy import deepcopy
mod = 10 ** 9 + 7
mod2 = 998244353

def ps(n):
	cp = 0
	lk = 0
	arr = {}
	lk = 0
	ap = n
	cc = 0
	while n % 2 == 0:
		n = n // 2
		cc = 1
	if cc == 1:
		lk += 1
	for ps in range(3, ceil(sqrt(n)) + 1, 2):
		cc = 0
		while n % ps == 0:
			n = n // ps
			cc = 1
		lk += 1 if cc == 1 else 0
	if n != 1:
		lk += 1
	if lk == 1:
		return False
	return True

def gcd(x, y):
	while y:
		(x, y) = (y, x % y)
	return x

def factorials(n, r):
	slr = n
	dpr = r
	qlr = 1
	qs = 1
	mod = 10 ** 9 + 7
	for ip in range(n - r + 1, n):
		qlr = qlr * ip % mod
	for ij in range(1, r):
		qs = qs * ij % mod
	ans = qlr * modInverse(qs) % mod
	return ans

def modInverse(b):
	qr = 10 ** 9 + 7
	return pow(b, qr - 2, qr)
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

def power(arr):
	listrep = arr
	subsets = []
	for i in range(2 ** len(listrep)):
		subset = []
		for k in range(len(listrep)):
			if i & 1 << k:
				subset.append(listrep[k])
		subsets.append(subset)
	return subsets

def pda(n):
	list = []
	su = 0
	for i in range(1, int(sqrt(n) + 1)):
		if n % i == 0:
			if n // i == i:
				list.append(i)
				su += i
			else:
				list.append(n // i)
				list.append(i)
				su += i
				su += n // i
	return su

def dis(xa, ya, xb, yb):
	return sqrt((xa - xb) ** 2 + (ya - yb) ** 2)

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

def ilist():
	return [int(x) for x in input().strip().split()]

def islist():
	return list(map(str, input().split().rstrip()))

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

def google(test):
	return 'Case #' + str(test) + ': '

def overlap(x1, y1, x2, y2):
	if x2 > y1:
		return y1 - x2
	if y1 > y2:
		return y2 - x2
	return y1 - x2

def dist(x1, y1, x2, y2):
	return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2)

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

def prod(arr):
	n = len(arr)
	k = 1
	for j in range(n):
		k *= arr[j]
	return k

def SumOfDigits(s):
	su = 0
	while s:
		su += s % 10
		s = s // 10
	return su
t = 1
for pl in range(t):
	n = ii()
	arr = []
	for i in range(n + 1):
		brr = ilist()
	print(floor((n - 4) / 2))


read = lambda : list(map(int, input().split()))
vect = lambda a, b: a[0] * b[1] - a[1] * b[0]
vector = lambda A, B: (B[0] - A[0], B[1] - A[1])
n = int(input())
p = [tuple(read()) for i in range(n)]
cnt = 0
for i in range(2, n):
	v1 = vector(p[i], p[i - 1])
	v2 = vector(p[i - 1], p[i - 2])
	if vect(v1, v2) < 0:
		cnt += 1
print(cnt)


class Coordenada:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def distancia(self, anterior):
		return max(abs(self.x - anterior.x), abs(self.y - anterior.y))

	def to(self, anterior):
		delta_x = self.x - anterior.x
		delta_y = self.y - anterior.y
		if delta_x == 0 and delta_y > 0:
			return 'norte'
		elif delta_x == 0 and delta_y < 0:
			return 'sul'
		elif delta_y == 0 and delta_x > 0:
			return 'leste'
		else:
			return 'oeste'

	def perigosa(self, anterior, proximo):
		if self.to(anterior) == 'leste':
			if proximo.to(self) == 'norte':
				return True
			else:
				return False
		elif self.to(anterior) == 'oeste':
			if proximo.to(self) == 'sul':
				return True
			else:
				return False
		elif self.to(anterior) == 'norte':
			if proximo.to(self) == 'oeste':
				return True
			else:
				return False
		elif proximo.to(self) == 'leste':
			return True
		else:
			return False
n = int(input())
posicoes = []
for _ in range(n):
	(x, y) = map(int, input().split())
	posicoes.append(Coordenada(x, y))
c = 0
for i in range(1, n - 1):
	atual = posicoes[i]
	anterior = posicoes[i - 1]
	proximo = posicoes[i + 1]
	if atual.perigosa(anterior, proximo):
		c += 1
print(c)


n = int(input())
p = [tuple(map(int, input().split())) for i in range(n)]
vector = lambda A, B: (B[0] - A[0], B[1] - A[1])
vect = lambda A, B: A[0] * B[1] - A[1] * B[0]
print(sum((vect(vector(p[i], p[i - 1]), vector(p[i - 1], p[i - 2])) < 0 for i in range(2, n))))


n = int(input())
(a, b) = map(int, input().split())
(c, d) = map(int, input().split())
r = 0
for i in range(n - 1):
	(e, f) = map(int, input().split())
	(x, y, z, t) = (c - a, d - b, e - c, f - d)
	if x * t - y * z > 0:
		r += 1
	(a, b, c, d) = (c, d, e, f)
print(r)


n = int(input())
direction = 'N'
(x, y) = map(int, input().split())
k = 0
for i in range(n - 1):
	(z, t) = map(int, input().split())
	if z < x and t == y:
		if direction == 'N':
			k += 1
		direction = 'W'
	elif z > x and t == y:
		if direction == 'S':
			k += 1
		direction = 'E'
	elif z == x and t > y:
		if direction == 'E':
			k += 1
		direction = 'N'
	else:
		if direction == 'W':
			k += 1
		direction = 'S'
	(x, y) = (z, t)
print(k)


n = int(input())
xs = []
for _ in range(n + 1):
	(x, y) = map(int, input().split())
	xs.append((x, y))
ans = 0
for i in range(-1, n - 2):
	vx = xs[i + 2][0] - xs[i][0]
	vy = xs[i + 2][1] - xs[i][1]
	cx = xs[i + 1][0] - xs[i][0]
	cy = xs[i + 1][1] - xs[i][1]
	h = vx * cy - vy * cx
	if h < 0:
		ans += 1
print(ans)


n = int(input())
for i in range(n + 1):
	m = input()
print(int((n - 4) / 2))


def main():
	N = int(input())
	x = []
	y = []
	for n in range(N + 1):
		(a, b) = [int(i) for i in input().split()]
		x.append(a)
		y.append(b)
	qtd = 0
	for n in range(1, N):
		ux = x[n] - x[n - 1]
		uy = y[n] - y[n - 1]
		wx = x[n + 1] - x[n]
		wy = y[n + 1] - y[n]
		if ux * wy - wx * uy > 0:
			qtd += 1
	print(qtd)
main()


class StdIO:

	def read_int(self):
		return int(self.read_string())

	def read_ints(self, sep=None):
		return [int(i) for i in self.read_strings(sep)]

	def read_float(self):
		return float(self.read_string())

	def read_floats(self, sep=None):
		return [float(i) for i in self.read_strings(sep)]

	def read_string(self):
		return input()

	def read_strings(self, sep=None):
		return self.read_string().split(sep)
io = StdIO()

def left(u, v):
	(ux, uy) = u
	(vx, vy) = v
	z = ux * vy - uy * vx
	return z > 0

def main():
	n = io.read_int()
	(x0, y0) = io.read_ints()
	(x1, y1) = io.read_ints()
	pv = (x1 - x0, y1 - y0)
	(ppx, ppy) = (x1, y1)
	dang = 0
	for i in range(2, n + 1):
		(px, py) = io.read_ints()
		v = (px - ppx, py - ppy)
		if left(pv, v):
			dang += 1
		pv = v
		(ppx, ppy) = (px, py)
	print(dang)
main()


t = int(input())
l = []
e = 0
r = t // 2
r = r - 2
for i in range(t):
	if len(l) == 3:
		if l[0][0] == l[1][0] and l[2][0] > l[1][0]:
			e += 1
		elif l[0][1] == l[1][1] and l[2][1] > l[1][1]:
			e += 1
		l.pop(0)
	(m, n) = map(int, input().split())
	l.append((m, n))
print(r)


def ccw(a, b, c):
	ab = (b[1] - a[1], b[0] - a[0])
	ac = (c[1] - a[1], c[0] - a[0])
	charge = ab[0] * ac[1] - ab[1] * ac[0]
	return charge > 0

def countccw(points):
	c = 0
	for i in range(len(points) - 2):
		if ccw(points[i], points[i + 1], points[i + 2]):
			c += 1
	return c

def countcw(points):
	c = 0
	for i in range(len(points) - 2):
		if not ccw(points[i], points[i + 1], points[i + 2]):
			c += 1
	return c
n = int(input())
points = [tuple((int(x) for x in input().split())) for i in range(n + 1)]
if ccw(points[-3], points[-2], points[-1]):
	print(countcw(points))
else:
	print(countccw(points))


n = int(input()) + 1
arr = []
for i in range(n):
	arr.append(list(map(int, input().split())))
cnt = 0
for i in range(1, n - 1):
	p1 = arr[i - 1]
	p2 = arr[i]
	p3 = arr[i + 1]
	p3 = [p3[0] - p2[0], p3[1] - p2[1]]
	p2 = [p2[0] - p1[0], p2[1] - p1[1]]
	val = p3[0] * p2[1] - p3[1] * p2[0]
	if val < 0:
		cnt += 1
print(cnt)


n = input('')
n = int(n)
cw = False
prevX = 0
prevY = 0
prevDir = '?'
danger = 0
for i in range(n):
	l = input('')
	l = l.split(' ')
	x = int(l[0])
	y = int(l[1])
	if i >= 1:
		currDir = '?'
		if prevX == x and y > prevY:
			currDir = 'N'
		elif prevX == x and y < prevY:
			currDir = 'S'
		elif x < prevX:
			currDir = 'L'
		else:
			currDir = 'R'
		if i == 1:
			cw = currDir == 'N'
		if i >= 2:
			rightTurn = prevDir == 'N' and currDir == 'R' or (prevDir == 'R' and currDir == 'S') or (prevDir == 'S' and currDir == 'L') or (prevDir == 'L' and currDir == 'N')
			if cw and (not rightTurn):
				danger += 1
			if not cw and rightTurn:
				danger += 1
		prevDir = currDir
	prevX = x
	prevY = y
print(danger)


n = int(input())
(a, b) = (0, 0)
gi = lambda : map(int, input().split(' '))
(u, v) = gi()
(x, y) = gi()
for _ in range(n - 1):
	(p, q) = gi()
	w = (x - u) * (q - y) - (y - v) * (p - x)
	if w < 0:
		a += 1
	else:
		b += 1
	(u, v, x, y) = (x, y, p, q)
print(min(a, b))


class Point:

	def __init__(self, x, y):
		self.x = x
		self.y = y

	def __str__(self):
		return str(self.x) + ',' + str(self.y)

class Vec:

	def __init__(self, x, y):
		self.x = x
		self.y = y

def cross(a, b):
	return a.x * b.y - a.y * b.x

def toVec(a, b):
	return Vec(b.x - a.x, b.y - a.y)

def ccw(p, q, r):
	return cross(toVec(p, q), toVec(p, r)) > 0

def main():
	n = int(input())
	P = []
	count = 0
	while n >= 0:
		(x, y) = list(map(int, input().split()))
		P.append(Point(x, y))
		n -= 1
	isLeft = ccw(P[0], P[1], P[2])
	for i in range(1, len(P) - 1):
		if i + 2 == len(P):
			aux = 1
		else:
			aux = i + 2
		a = ccw(P[i], P[i + 1], P[aux])
		if isLeft == True and a == True:
			count += 1
		elif isLeft == False and a == True:
			count += 1
	if isLeft == True:
		count += 1
	print(count)
main()


a = input()
a = int(a)
print((a - 4) // 2)


n = int(input())
ans = int((n - 4) / 2)
print(ans)


from copy import copy
p0 = []
p1 = []
p2 = []
i = int(input()) - 1
(a, b) = input().split()
p0.append(int(a))
p0.append(int(b))
(a, b) = input().split()
p1.append(int(a))
p1.append(int(b))
caiu = 0
while i:
	i -= 1
	(a, b) = input().split()
	p2.append(int(a))
	p2.append(int(b))
	if p0[1] < p1[1] and p1[0] > p2[0]:
		caiu += 1
	elif p0[0] < p1[0] and p1[1] < p2[1]:
		caiu += 1
	elif p0[1] > p1[1] and p1[0] < p2[0]:
		caiu += 1
	elif p0[0] > p1[0] and p1[1] > p2[1]:
		caiu += 1
	p0 = copy(p1)
	p1 = copy(p2)
	p2 = []
print(caiu)


n = int(input())
initial = ''

def finddirec(prev, nxt):
	if prev[0] == nxt[0]:
		if nxt[1] > prev[1]:
			return 'N'
		else:
			return 'S'
	elif prev[0] < nxt[0]:
		return 'E'
	else:
		return 'W'
prev = list(map(int, input().split()))
ans = 0
for i in range(n):
	nxt = list(map(int, input().split()))
	final = finddirec(prev, nxt)
	if initial == 'N' and final == 'W':
		ans += 1
	if initial == 'S' and final == 'E':
		ans += 1
	if initial == 'E' and final == 'N':
		ans += 1
	if initial == 'W' and final == 'S':
		ans += 1
	prev = nxt
	initial = final
print(ans)


import sys
n = int(sys.stdin.readline().strip())
print((n - 4) // 2)


def dir(p1, p2):
	x = p1[0] - p2[0]
	y = p1[1] - p2[1]
	if y < 0:
		return 'N'
	if y > 0:
		return 'S'
	if x < 0:
		return 'W'
	if x > 0:
		return 'E'
n = int(input())
p = []
c = 0
p.append(list(map(int, input().strip().split())))
p.append(list(map(int, input().strip().split())))
for i in range(2, n + 1):
	p.append(list(map(int, input().strip().split())))
	if dir(p[i - 2], p[i - 1]) == 'N' and dir(p[i - 1], p[i]) == 'E':
		c += 1
	if dir(p[i - 2], p[i - 1]) == 'W' and dir(p[i - 1], p[i]) == 'N':
		c += 1
	if dir(p[i - 2], p[i - 1]) == 'S' and dir(p[i - 1], p[i]) == 'W':
		c += 1
	if dir(p[i - 2], p[i - 1]) == 'E' and dir(p[i - 1], p[i]) == 'S':
		c += 1
print(c)


n = int(input())
while True:
	try:
		i = 0
		a = []
		b = []
		while i <= n:
			rangeD = input()
			rangeD = rangeD.split()
			a.append(int(rangeD[0]))
			b.append(int(rangeD[1]))
			i += 1
		counter = 0
		i = 1
		while i < n:
			if (a[i] - a[i - 1]) * (b[i + 1] - b[i]) - (b[i] - b[i - 1]) * (a[i + 1] - a[i]) > 0:
				counter += 1
			i += 1
		print(counter)
	except:
		break


n = int(input())
l = []
for i in range(n):
	temp = input().split(' ')
	temp = [int(x) for x in temp]
	l.append(temp)
dangerousCorner = 0
for i in range(len(l) - 2):
	if l[i + 1][1] - l[i][1] > 0:
		if l[i + 2][0] - l[i + 1][0] < 0:
			dangerousCorner += 1
	elif l[i + 1][1] - l[i][1] < 0:
		if l[i + 2][0] - l[i + 1][0] > 0:
			dangerousCorner += 1
	elif l[i + 1][0] - l[i][0] < 0:
		if l[i + 2][1] - l[i + 1][1] < 0:
			dangerousCorner += 1
	elif l[i + 1][0] - l[i][0] > 0:
		if l[i + 2][1] - l[i + 1][1] > 0:
			dangerousCorner += 1
print(dangerousCorner)


n = int(input())
count = 0
(lx, ly) = map(int, input().split())
lv = (0, 1)
for i in range(n):
	(x, y) = map(int, input().split())
	v = (x - lx, y - ly)
	if lv[1] * v[0] < 0 or lv[0] * v[1] > 0:
		count += 1
	lv = v
	(lx, ly) = (x, y)
print(count)


n = int(input())
counter = 0
direction = 0
input()
(x_0, y_0) = map(int, input().split())
for i in range(n - 1):
	(x_1, y_1) = map(int, input().split())
	if direction == 0:
		if x_1 < x_0:
			counter += 1
	elif direction == 1:
		if y_1 > y_0:
			counter += 1
	elif direction == 2:
		if x_0 < x_1:
			counter += 1
	elif direction == 3:
		if y_1 < y_0:
			counter += 1
	if direction == 0 or direction == 2:
		if x_1 < x_0:
			direction = 3
		else:
			direction = 1
	elif y_1 > y_0:
		direction = 0
	else:
		direction = 2
	(x_0, y_0) = (x_1, y_1)
print(counter)


n = int(input())
for _ in range(n):
	input()
print((n - 4) // 2)


n = int(input())
print('%d' % ((n - 4) / 2))


n = int(input())
points = []
answer = 0

def vectorProduct(point1, point2, point3):
	(det, ret) = (0, 0)
	newPoint1 = (point1[0] - point2[0], point1[1] - point2[1])
	newPoint2 = (point3[0] - point2[0], point3[1] - point2[1])
	(x1, y1) = newPoint1
	(x2, y2) = newPoint2
	det = x1 * y2 - x2 * y1
	if det > 0:
		ret = 1
	elif det < 0:
		ret = -1
	elif det == 0:
		ret = 0
	return ret
for _ in range(n + 1):
	[x, y] = map(int, input().split())
	points.append((x, y))
for (indice, (x, y)) in enumerate(points):
	if vectorProduct(points[indice % len(points)], points[(indice + 1) % len(points)], points[(indice + 2) % len(points)]) == -1:
		answer += 1
print(answer)


points = int(input())
last_dir = 'North'
(x, y) = map(int, input().split())
last_point = (x, y)
left_turns = 0
for i in range(0, points):
	(x, y) = map(int, input().split())
	if not x - last_point[0] == 0:
		if x - last_point[0] > 0:
			if last_dir == 'North':
				pass
			if last_dir == 'South':
				left_turns += 1
			last_dir = 'East'
		if x - last_point[0] < 0:
			if last_dir == 'North':
				left_turns += 1
			if last_dir == 'South':
				pass
			last_dir = 'West'
	if not y - last_point[1] == 0:
		if y - last_point[1] > 0:
			if last_dir == 'East':
				left_turns += 1
			if last_dir == 'West':
				pass
			last_dir = 'North'
		if y - last_point[1] < 0:
			if last_dir == 'East':
				pass
			if last_dir == 'West':
				left_turns += 1
			last_dir = 'South'
	last_point = (x, y)
print(left_turns)


n = int(input())
a = []
s = 'N'
counter = 0
for i in range(n + 1):
	(x, y) = list(map(int, input().split()))
	a.append([x, y])
for i in range(2, n + 1):
	if i % 2:
		if a[i][1] - a[i - 1][1] > 0:
			if s == 'E':
				counter += 1
			s = 'N'
		else:
			if s == 'W':
				counter += 1
			s = 'S'
	elif a[i][0] - a[i - 1][0] > 0:
		if s == 'S':
			counter += 1
		s = 'E'
	else:
		if s == 'N':
			counter += 1
		s = 'W'
print(counter)


import time
n = int(input())
x = []
y = []
(x0, y0) = (int(i) for i in input().split())
for i in range(n):
	(x1, y1) = (int(i) for i in input().split())
	x.append(x1 - x0)
	y.append(y1 - y0)
	x0 = x1
	y0 = y1
start = time.time()
ans = 0
for i in range(n - 1):
	if x[i] * y[i + 1] - x[i + 1] * y[i] > 0:
		ans += 1
if x[n - 1] * y[0] - x[0] * y[n - 1] > 0:
	ans += 1
print(ans)
finish = time.time()


num = int(input())
track = []
for i in range(num + 1):
	temp = list(map(int, input().split()))
	track.append(temp)

def checkDirection(pointOne, pointTwo):
	if pointOne[0] < pointTwo[0]:
		return 'E'
	if pointOne[0] > pointTwo[0]:
		return 'W'
	if pointOne[1] < pointTwo[1]:
		return 'N'
	if pointOne[1] > pointTwo[1]:
		return 'S'

def checkDanger(pointOne, pointTwo, pointThree):
	first = checkDirection(pointOne, pointTwo)
	second = checkDirection(pointTwo, pointThree)
	if first == 'W' and second == 'S' or (first == 'S' and second == 'E') or (first == 'N' and second == 'W') or (first == 'E' and second == 'N'):
		return True
	else:
		return False
numDanger = 0
for i in range(1, len(track) - 1):
	if checkDanger(track[i - 1], track[i], track[i + 1]):
		numDanger += 1
print(numDanger)


n = int(input()) - 1
c = list(map(int, input().split()))
p = list(map(int, input().split()))
o = [[p[0], 1], [0, 0]]
s = [1, -1]
cnt = 0
i = 0
for z in range(n):
	c = list(map(int, input().split()))
	if o[i][1] * c[i] < o[i][1] * o[i][0]:
		cnt += 1
	j = i ^ 1
	o[j][0] = c[j]
	o[j][1] = 1 if s[j] * c[i] > s[j] * p[i] else -1
	i = j
	p = c
print(cnt)


def dangerous_turns(number_of_straight_sections):
	return (number_of_straight_sections - 4) // 2

def main():
	number_of_straight_sections = int(input())
	points = []
	for i in range(number_of_straight_sections + 1):
		point = list(map(lambda x: float(x), input().split(' ')))
		points.append(point)
	print(dangerous_turns(number_of_straight_sections))
main()


def direction(a, b):
	if a[0] == b[0]:
		if a[1] < b[1]:
			return 'U'
		return 'D'
	if a[0] < b[0]:
		return 'R'
	return 'L'

def dangerous(a, b):
	if a == 'R' and b == 'U':
		return True
	if a == 'U' and b == 'L':
		return True
	if a == 'L' and b == 'D':
		return True
	if a == 'D' and b == 'R':
		return True
	return False
n = int(input()) + 1
l = []
for i in range(n):
	l.append(list(map(int, input().split())))
l1 = []
for i in range(n - 1):
	l1.append(direction(l[i], l[i + 1]))
ans = 0
for i in range(n - 2):
	if dangerous(l1[i], l1[i + 1]):
		ans += 1
print(ans)


def isLeft(x1, y1, x2, y2, x3, y3):
	return (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1) < 0

def isMn(s):
	return not (True in s and False in s)

def pr():
	for i in range(1, n - 1):
		s.append(isLeft(x[i - 1], y[i - 1], x[i], y[i], x[i + 1], y[i + 1]))
	s.append(isLeft(x[-1], y[-1], x[0], y[0], x[1], y[1]))
	s.append(isLeft(x[-2], y[-2], x[-1], y[-1], x[0], y[0]))
n = int(input())
x = []
y = []
for i in range(n):
	(a, b) = map(int, input().split())
	x.append(a)
	y.append(b)
s = []
pr()
ans = 0
for i in range(len(s)):
	if not s[i]:
		ans += 1
print(min(ans, len(s) - ans))


n = int(input())
data = [list(map(int, input().split())) for i in range(n + 1)]
ans = 0
for i in range(n - 3):
	(x0, y0, x1, y1, x2, y2) = (data[i][0], data[i][1], data[i + 1][0], data[i + 1][1], data[i + 2][0], data[i + 2][1])
	if y0 == y1 and x1 == x2:
		ans += 1
print(ans)


turns = []
danger = 0

def direction(x1, y1, x2, y2):
	if x1 == x2:
		if y2 > y1:
			return 'n'
		else:
			return 's'
	elif x2 > x1:
		return 'e'
	else:
		return 'w'
n = int(input())
for i in range(n):
	(x, y) = input().split(' ')
	x = int(x)
	y = int(y)
	turns.append([x, y])
for (pair, next_pair, next_next_pair) in zip(turns, turns[1:] + turns[0:1], turns[2:] + turns[:2]):
	d = direction(pair[0], pair[1], next_pair[0], next_pair[1])
	next_d = direction(next_pair[0], next_pair[1], next_next_pair[0], next_next_pair[1])
	if d == 'e' and next_d == 'n':
		danger += 1
	elif d == 's' and next_d == 'e':
		danger += 1
	elif d == 'w' and next_d == 's':
		danger += 1
	elif d == 'n' and next_d == 'w':
		danger += 1
print(danger)


retas = int(input())
ponto = 0
curvas_perigosas = 0
x = []
y = []
while ponto <= retas:
	lista = list(input().split())
	pontox = lista[0]
	pontoy = lista[1]
	pontox = int(pontox)
	pontoy = int(pontoy)
	x.append(pontox)
	y.append(pontoy)
	ponto += 1
ponto = 0
while ponto <= retas:
	xponto1 = int(x[ponto])
	yponto1 = int(y[ponto])
	if retas - ponto >= 2:
		xponto2 = int(x[ponto + 1])
		yponto2 = int(y[ponto + 1])
		xponto3 = int(x[ponto + 2])
		yponto3 = int(y[ponto + 2])
		if xponto2 > xponto1 and yponto3 > yponto2:
			curvas_perigosas += 1
		if xponto2 < xponto1 and yponto3 < yponto2:
			curvas_perigosas += 1
		if yponto2 > yponto1 and xponto3 < xponto2:
			curvas_perigosas += 1
		if yponto2 < yponto1 and xponto3 > xponto2:
			curvas_perigosas += 1
	ponto += 1
print(curvas_perigosas)


n = int(input())
trackx = []
tracky = []
for i in range(n + 1):
	ent = list(map(int, input().split()))
	trackx.append(ent[0])
	tracky.append(ent[1])
perigo = 0
trackdir = ['N']
for i in range(1, n):
	if trackdir[i - 1] == 'N':
		if trackx[i + 1] > trackx[i]:
			trackdir.append('L')
		elif trackx[i + 1] < trackx[i]:
			trackdir.append('O')
	elif trackdir[i - 1] == 'L':
		if tracky[i + 1] > tracky[i]:
			trackdir.append('N')
		elif tracky[i + 1] < tracky[i]:
			trackdir.append('S')
	elif trackdir[i - 1] == 'S':
		if trackx[i + 1] > trackx[i]:
			trackdir.append('L')
		elif trackx[i + 1] < trackx[i]:
			trackdir.append('O')
	elif trackdir[i - 1] == 'O':
		if tracky[i + 1] > tracky[i]:
			trackdir.append('N')
		elif tracky[i + 1] < tracky[i]:
			trackdir.append('S')
	if trackdir[i - 1] == 'S' and trackdir[i] == 'L':
		perigo += 1
	if trackdir[i - 1] == 'L' and trackdir[i] == 'N':
		perigo += 1
	if trackdir[i - 1] == 'N' and trackdir[i] == 'O':
		perigo += 1
	if trackdir[i - 1] == 'O' and trackdir[i] == 'S':
		perigo += 1
print(perigo)


try:
	while True:
		n = int(input())
		(prev_x, prev_y) = list(map(int, input().split()))
		prev_d = 0
		result = 0
		for i in range(n):
			(x, y) = list(map(int, input().split()))
			if y > prev_y:
				d = 0
			elif x > prev_x:
				d = 1
			elif y < prev_y:
				d = 2
			else:
				d = 3
			if d + 1 & 3 == prev_d:
				result += 1
			(prev_x, prev_y) = (x, y)
			prev_d = d
		print(result)
except EOFError:
	pass


n = int(input())
dire = 0
p = list(map(int, input().split(' ')))
ans = 0
for i in range(n):
	pp = list(map(int, input().split(' ')))
	if p[1] < pp[1]:
		ddire = 0
	elif p[0] > pp[0]:
		ddire = 1
	elif p[1] > pp[1]:
		ddire = 2
	elif p[0] < pp[0]:
		ddire = 3
	if (dire + 1) % 4 == ddire:
		ans += 1
	(p, dire) = (pp, ddire)
print(ans)


(n, ans) = (int(input()), 0)
d = []
(x, y) = map(int, input().split())
for i in range(n):
	(a, b) = map(int, input().split())
	if x == a:
		if y < b:
			d.append(1)
		else:
			d.append(3)
	elif x > a:
		d.append(4)
	else:
		d.append(2)
	(x, y) = (a, b)
for i in range(n - 1):
	if d[i] == 1 and d[i + 1] == 4 or (d[i] == 2 and d[i + 1] == 1) or (d[i] == 4 and d[i + 1] == 3) or (d[i] == 3 and d[i + 1] == 2):
		ans += 1
print(ans)


n = int(input())
for i in range(n):
	(x, y) = [int(x) for x in input().split()]
print(n // 2 - 2)


n = int(input())
count = 0
for i in range(n + 1):
	if i > 1:
		x2 = x1
		y2 = y1
	if i > 0:
		x1 = x
		y1 = y
	(x, y) = map(int, input().split())
	if i > 1:
		if y1 > y2 and x < x1:
			count += 1
		elif y1 < y2 and x > x1:
			count += 1
		elif x1 > x2 and y > y1:
			count += 1
		elif x1 < x2 and y < y1:
			count += 1
print(count)


num_coord = int(input())
num_dangerous_turns = 0
x = []
y = []
i = 0
for i in range(num_coord + 1):
	coord = input()
	x.append(int(coord.split(' ')[0]))
	y.append(int(coord.split(' ')[1]))
i = 1
for i in range(num_coord):
	if x[i - 1] == x[i]:
		if y[i] > y[i - 1]:
			if x[i + 1] < x[i]:
				num_dangerous_turns = num_dangerous_turns + 1
		elif x[i + 1] > x[i]:
			num_dangerous_turns = num_dangerous_turns + 1
	elif x[i - 1] < x[i]:
		if y[i + 1] > y[i]:
			num_dangerous_turns = num_dangerous_turns + 1
	elif y[i + 1] < y[i]:
		num_dangerous_turns = num_dangerous_turns + 1
print(num_dangerous_turns)


n = int(input().strip())
(x1, y1) = [int(a) for a in input().strip().split()]
(x1, y1) = [int(a) for a in input().strip().split()]
dir1 = 'n'
c = 0
for i in range(n - 2):
	(x2, y2) = [int(a) for a in input().strip().split()]
	dx = x2 - x1
	dy = y2 - y1
	if dx < 0:
		dir2 = 'w'
	elif dx > 0:
		dir2 = 'e'
	elif dy < 0:
		dir2 = 's'
	elif dy > 0:
		dir2 = 'n'
	if dir1 == 'n' and dir2 == 'w':
		c += 1
	elif dir1 == 's' and dir2 == 'e':
		c += 1
	elif dir1 == 'w' and dir2 == 's':
		c += 1
	elif dir1 == 'e' and dir2 == 'n':
		c += 1
	dir1 = dir2
	(x1, y1) = (x2, y2)
print(c)


print((int(input()) - 4) // 2)


import sys
rotas = int(input())
for i in range(0, rotas + 1):
	(x, y) = input().split(' ')
	x = int(x)
	y = int(y)
	danger = int((rotas - 4) / 2)
print('%d' % danger)


def main():
	(n, l, res) = (int(input()), [], 0)
	(x, y) = map(int, input().split())
	for _ in range(n):
		(a, b) = map(int, input().split())
		l.append((x - a, y - b))
		(x, y) = (a, b)
	(a, b) = l[-1]
	for (x, y) in l:
		res += a * y > b * x
		(a, b) = (x, y)
	print(res)
main()


a = []
n = 0
res = 0
for i in range(int(input()) + 1):
	n += 1
	a.append(list(map(int, input().split())))
for i in range(n - 1):
	if a[i][0] < a[i + 1][0] and a[i][1] == a[i + 1][1]:
		if a[i - 1][0] == a[i][0] and a[i - 1][1] > a[i][1]:
			res += 1
	elif a[i][0] == a[i + 1][0] and a[i][1] > a[i + 1][1]:
		if a[i - 1][0] > a[i][0] and a[i - 1][1] == a[i][1]:
			res += 1
	elif a[i][0] > a[i + 1][0] and a[i][1] == a[i + 1][1]:
		if a[i - 1][0] == a[i][0] and a[i - 1][1] < a[i][1]:
			res += 1
	elif a[i][0] == a[i + 1][0] and a[i][1] < a[i + 1][1]:
		if a[i - 1][0] < a[i][0] and a[i - 1][1] == a[i][1]:
			res += 1
print(res)


pista = list()
num_retas = int(input())
curvas_perigo = 0
curvas_perigo = int(num_retas - 4) / 2
print('{0:.0f}'.format(curvas_perigo))


read_ints = lambda : list(map(int, input().split()))

def solve(ps):
	ans = 0
	for i in range(len(ps) - 2):
		if ccw(ps[i], ps[i + 1], ps[i + 2]):
			ans += 1
	return ans

def ccw(p1, p2, p3):
	return (p2[0] - p1[0]) * (p3[1] - p1[1]) - (p2[1] - p1[1]) * (p3[0] - p1[0]) > 0

def __starting_point():
	n = int(input())
	ps = []
	for i in range(n + 1):
		ps.append(read_ints())
	print(solve(ps))
__starting_point()


a = int(input())
print(a // 2 - 2)


n = int(input())
vertical = []
horizontal = []
l = []
ans = 0
for i in range(n + 1):
	l.append([int(j) for j in input().split()])
unique = {}
unique_id = 1
for i in range(1, n + 1):
	if l[i][0] == l[i - 1][0]:
		vertical.append([min(l[i][1], l[i - 1][1]), max(l[i][1], l[i - 1][1]), l[i][0]])
		unique[unique_id] = [min(l[i][1], l[i - 1][1]), max(l[i][1], l[i - 1][1]), l[i][0], 'v']
	else:
		horizontal.append([min(l[i][0], l[i - 1][0]), max(l[i][0], l[i - 1][0]), l[i][1]])
		unique[unique_id] = [min(l[i][0], l[i - 1][0]), max(l[i][0], l[i - 1][0]), l[i][1], 'h']
	unique_id += 1
for i in range(1, n + 1):
	if l[i][0] == l[i - 1][0]:
		if l[i][1] > l[i - 1][1]:
			direction = 'up'
		else:
			direction = 'down'
		count = 0
		if direction == 'up':
			for j in horizontal:
				if l[i][0] > j[0] and l[i][0] < j[1] and (l[i][1] < j[2]):
					count += 1
			for k in unique:
				if unique[k][2] == l[i][0] and unique[k][3] == 'v' and (unique[k][0] > l[i][1]):
					if k == 1:
						key1 = n
						key2 = 2
					elif k == n:
						key1 = n - 1
						key2 = 1
					else:
						key1 = k - 1
						key2 = k + 1
					if unique[key1][1] == l[i][0] and unique[key2][0] == l[i][0]:
						count += 1
					elif unique[key1][0] == l[i][0] and unique[key2][1] == l[i][0]:
						count += 1
			if count % 2 == 1:
				ans += 1
		else:
			for j in horizontal:
				if l[i][0] > j[0] and l[i][0] < j[1] and (l[i][1] > j[2]):
					count += 1
			for k in unique:
				if unique[k][2] == l[i][0] and unique[k][3] == 'v' and (unique[k][1] < l[i][1]):
					if k == 1:
						key1 = n
						key2 = 2
					elif k == n:
						key1 = n - 1
						key2 = 1
					else:
						key1 = k - 1
						key2 = k + 1
					if unique[key1][1] == l[i][0] and unique[key2][0] == l[i][0]:
						count += 1
					elif unique[key1][0] == l[i][0] and unique[key2][1] == l[i][0]:
						count += 1
			if count % 2 == 1:
				ans += 1
	else:
		if l[i][0] > l[i - 1][0]:
			direction = 'right'
		else:
			direction = 'left'
		count = 0
		if direction == 'right':
			for j in vertical:
				if l[i][1] > j[0] and l[i][1] < j[1] and (l[i][0] < j[2]):
					count += 1
			for k in unique:
				if unique[k][2] == l[i][1] and unique[k][3] == 'h' and (unique[k][0] > l[i][0]):
					if k == 1:
						key1 = n
						key2 = 2
					elif k == n:
						key1 = n - 1
						key2 = 1
					else:
						key1 = k - 1
						key2 = k + 1
					if unique[key1][1] == l[i][1] and unique[key2][0] == l[i][1]:
						count += 1
					elif unique[key1][0] == l[i][1] and unique[key2][1] == l[i][1]:
						count += 1
			if count % 2 == 1:
				ans += 1
		else:
			for j in vertical:
				if l[i][1] > j[0] and l[i][1] < j[1] and (l[i][0] > j[2]):
					count += 1
			for k in unique:
				if unique[k][2] == l[i][1] and unique[k][3] == 'h' and (unique[k][1] < l[i][0]):
					if k == 1:
						key1 = n
						key2 = 2
					elif k == n:
						key1 = n - 1
						key2 = 1
					else:
						key1 = k - 1
						key2 = k + 1
					if unique[key1][1] == l[i][1] and unique[key2][0] == l[i][1]:
						count += 1
					elif unique[key1][0] == l[i][1] and unique[key2][1] == l[i][1]:
						count += 1
			if count % 2 == 1:
				ans += 1
print(ans)


params = input().split()
number = int(params[0])
p = []
c = 0
for x in range(number):
	i = input().split()
	x = int(i[0])
	y = int(i[1])
	p.append({'x': x, 'y': y, 'direction': '', 'turn': ''})
p.append(p[0])
p[0]['direction'] = 'U'
p[1]['direction'] = 'U'
for x in range(1, number):
	if p[x]['direction'] == 'U':
		if p[x]['x'] > p[x + 1]['x']:
			p[x]['turn'] = 'L'
			p[x + 1]['direction'] = 'L'
		if p[x]['x'] < p[x + 1]['x']:
			p[x]['turn'] = 'R'
			p[x + 1]['direction'] = 'R'
	if p[x]['direction'] == 'D':
		if p[x]['x'] > p[x + 1]['x']:
			p[x]['turn'] = 'R'
			p[x + 1]['direction'] = 'L'
		if p[x]['x'] < p[x + 1]['x']:
			p[x]['turn'] = 'L'
			p[x + 1]['direction'] = 'R'
	if p[x]['direction'] == 'L':
		if p[x]['y'] > p[x + 1]['y']:
			p[x]['turn'] = 'L'
			p[x + 1]['direction'] = 'D'
		if p[x]['y'] < p[x + 1]['y']:
			p[x]['turn'] = 'R'
			p[x + 1]['direction'] = 'U'
	if p[x]['direction'] == 'R':
		if p[x]['y'] > p[x + 1]['y']:
			p[x]['turn'] = 'R'
			p[x + 1]['direction'] = 'D'
		if p[x]['y'] < p[x + 1]['y']:
			p[x]['turn'] = 'L'
			p[x + 1]['direction'] = 'U'
for x in range(number):
	if p[x]['turn'] == 'L':
		c += 1
print(c)


n = int(input())
m = []
s = None
ind = 0
for i in range(n):
	(a, b) = tuple(map(int, input().split()))
	m.append((a, b))
	if s == None:
		s = (a, b)
		ind = i
	elif b < s[1]:
		s = (a, b)
		ind = i
	elif b == s[1] and a < s[0]:
		s = (a, b)
		ind = i
su = 0
for i in range(n):
	i0 = (i + ind) % n
	i1 = (i0 + 1) % n
	i2 = (i0 + 2) % n
	dx1 = m[i1][0] - m[i0][0]
	dx2 = m[i2][0] - m[i0][0]
	dy1 = m[i1][1] - m[i0][1]
	dy2 = m[i2][1] - m[i0][1]
	if dx1 > 0 and dy1 == 0 and (dx2 > 0) and (dy2 > 0) or (dx1 == 0 and dy1 < 0 and (dx2 > 0) and (dy2 < 0)) or (dx1 < 0 and dy1 == 0 and (dx2 < 0) and (dy2 < 0)) or (dx1 == 0 and dy1 > 0 and (dx2 < 0) and (dy2 > 0)):
		su += 1
print(su)


def signum(i):
	return 0 if i == 0 else 1 if i > 0 else -1

def race(n, P):
	q = P[-2]
	e = (0, -1)
	c = 0
	for p in P:
		d = (signum(p[0] - q[0]), signum(p[1] - q[1]))
		if e[0] * d[1] - e[1] * d[0] > 0:
			c += 1
		e = d
		q = p
	return c

def main():
	n = readint()
	P = readinttl(n)
	print(race(n, P))
import sys

def readint():
	return int(input())

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

def readintt():
	return tuple(readinti())

def readintl():
	return list(readinti())

def readinttl(k):
	return [readintt() for _ in range(k)]

def readintll(k):
	return [readintl() for _ in range(k)]

def log(*args, **kwargs):
	print(*args, **kwargs, file=sys.stderr)
main()


n = int(input())
print(n // 2 - 2)


n = int(input())
liste = []
for i in range(n + 1):
	(x, y) = [int(element) for element in input().split(' ')]
	liste.append((x, y))

def orientation(p1, p2, p3):
	k = (p2[1] - p1[1]) * (p3[0] - p2[0]) - (p2[0] - p1[0]) * (p3[1] - p2[1])
	if k < 0:
		return 1
	else:
		return 0
count = 0
for i in range(1, n):
	count += orientation(liste[i - 1], liste[i], liste[i + 1])
print(count)


def Todito(pos, D, R):
	c = 0
	for k in range(1, n):
		ax = D[k - 1]
		ay = R[k - 1]
		bx = D[k]
		by = R[k]
		cx = D[k + 1]
		cy = R[k + 1]
		if (ax == bx and ay < by) and (by == cy and cx < bx) or ((ay == by and ax < bx) and (bx == cx and by < cy)) or ((ax == bx and ay > by) and (by == cy and bx < cx)) or ((ay == by and ax > bx) and (bx == cx and by > cy)):
			c += 1
	return c
n = int(input())
pointsdom = []
pointsran = []
maximo = 0
p = 0
for k in range(n + 1):
	l = input()
	l = l.split()
	if int(l[0]) > maximo:
		maximo = int(l[0])
		p = k
	if int(l[1]) > maximo:
		maximo = int(l[1])
		p = k
	pointsdom.append(int(l[0]))
	pointsran.append(int(l[1]))
T = Todito(p, pointsdom, pointsran)
print(T)


n = int(input())
points = []
ans = 0
for i in range(n):
	(x1, y1) = (int(i) for i in input().split())
	points += [[x1, y1]]
for i in range(n):
	x1 = points[i][0]
	y1 = points[i][1]
	x2 = points[(i + 1) % n][0]
	y2 = points[(i + 1) % n][1]
	x3 = points[(i + 2) % n][0]
	y3 = points[(i + 2) % n][1]
	if y1 == y2:
		if x2 > x1:
			if y3 > y2:
				ans += 1
		elif y3 < y2:
			ans += 1
	elif y2 > y1:
		if x3 < x2:
			ans += 1
	elif x2 < x3:
		ans += 1
print(ans)


n = int(input())
ans = 0
points = []
for _ in range(n):
	points.append(tuple(map(int, input().split(' '))))
a = input()
for i in range(n):
	(a, b, c) = (i, i + 1, i + 2)
	(b, c) = (b % n, c % n)
	v1 = (points[b][0] - points[a][0], points[b][1] - points[a][1])
	v2 = (points[c][0] - points[b][0], points[c][1] - points[b][1])
	if v1[1] * v2[0] - v1[0] * v2[1] < 0:
		ans += 1
print(ans)


import math
n = int(input())
result = 0
points_x = []
points_y = []
for i in range(0, n):
	(t_x, t_y) = map(int, input().split())
	points_x.append(t_x)
	points_y.append(t_y)

def inPolygon(x, y, xp, yp):
	c = 0
	for i in range(len(xp)):
		if (yp[i] <= y and y < yp[i - 1] or (yp[i - 1] <= y and y < yp[i])) and x > (xp[i - 1] - xp[i]) * (y - yp[i]) / (yp[i - 1] - yp[i]) + xp[i]:
			c = 1 - c
	return c
for i in range(1, n):
	offset_x = points_x[i] - points_x[i - 1]
	offset_y = points_y[i] - points_y[i - 1]
	out = offset_y
	if offset_x != 0:
		offset_x = math.copysign(0.5, offset_x)
	if offset_y != 0:
		offset_y = math.copysign(0.5, offset_y)
	result += inPolygon(points_x[i] + offset_x, points_y[i] + offset_y, points_x, points_y)
print(result)


num = int(input())
vertices = []
for i in range(0, num):
	par = input().split()
	vertices.append((int(par[0]), int(par[1])))
curvas = 0
for p in range(-2, num - 2):
	if vertices[p][0] < vertices[p + 1][0] and vertices[p + 1][1] < vertices[p + 2][1]:
		curvas += 1
	elif vertices[p][1] > vertices[p + 1][1] and vertices[p + 1][0] < vertices[p + 2][0]:
		curvas += 1
	elif vertices[p][0] > vertices[p + 1][0] and vertices[p + 1][1] > vertices[p + 2][1]:
		curvas += 1
	elif vertices[p][1] < vertices[p + 1][1] and vertices[p + 1][0] > vertices[p + 2][0]:
		curvas += 1
print(curvas)


n = int(input())
l = [tuple(map(int, input().split())) for i in range(n + 1)]
ans = 0
for i in range(1, n - 1):
	(xo, yo) = l[i - 1]
	(xx, yy) = l[i]
	(x, y) = l[i + 1]
	if (xx - xo) * (y - yo) - (x - xo) * (yy - yo) > 0:
		ans += 1
print(ans)


def main():
	(NORTE, SUL, LESTE, OESTE) = range(0, 4)
	n = input()
	n = int(n)
	if n < 0 or n > 1000:
		return 0
	dir = NORTE
	contador = 0
	aux = input()
	(old_x, old_y) = aux.split(' ')
	(old_x, old_y) = (int(old_x), int(old_y))
	for _ in range(0, n):
		aux = input()
		(x, y) = aux.split(' ')
		(x, y) = (int(x), int(y))
		if x < -10000 or x > 10000 or y < -10000 or (y > 10000):
			return
		if old_x < x:
			if dir == NORTE:
				contador += 1
			dir = LESTE
		if old_x > x:
			if dir == SUL:
				contador += 1
			dir = OESTE
		if old_y < y:
			if dir == LESTE:
				contador += 1
			dir = SUL
		if old_y > y:
			if dir == OESTE:
				contador += 1
			dir = NORTE
		(old_x, old_y) = (x, y)
	print(contador)
	return 0
main()


from sys import stdin, stderr

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

def print_err(*args, **kwargs):
	print(*args, file=stderr, **kwargs)

def solve(n, vs):
	cur_dir = 0
	next_dir = 0
	lake = 1
	bad_turns = 0
	ix_skip = 0
	(cx, cy) = (0, 0)
	for (nx, ny) in vs:
		if ix_skip == 0:
			ix_skip += 1
			continue
		if ix_skip == 1:
			(cx, cy) = (nx, ny)
			ix_skip += 1
			continue
		if cur_dir % 2 == 0:
			if nx > cx:
				next_dir = 1
			else:
				next_dir = 3
			cx = nx
		else:
			if ny > cy:
				next_dir = 0
			else:
				next_dir = 2
			cy = ny
		if next_dir != lake:
			bad_turns += 1
		lake += next_dir - cur_dir
		lake %= 4
		cur_dir = next_dir
	return bad_turns

def run():
	(n,) = readInts()
	vs = []
	for _ in range(n + 1):
		vs.append(readInts())
	print(solve(n, vs))
run()


n = int(input())
arr = []
for i in range(n + 1):
	inn = [int(x) for x in input().split()]
	arr.append(inn)
dir = 1
cnt = 0
for i in range(n - 1):
	if dir == 1:
		if arr[i + 2][0] > arr[i + 1][0]:
			dir = 2
		else:
			dir = 4
			cnt += 1
	elif dir == 2:
		if arr[i + 2][1] < arr[i + 1][1]:
			dir = 3
		else:
			dir = 1
			cnt += 1
	elif dir == 3:
		if arr[i + 2][0] < arr[i + 1][0]:
			dir = 4
		else:
			dir = 2
			cnt += 1
	elif arr[i + 2][1] > arr[i + 1][1]:
		dir = 1
	else:
		dir = 3
		cnt += 1
print(cnt)


n = int(input())
a = []
for i in range(n):
	(x, y) = map(int, input().split())
	a.append([x, y])
ans = 0
for i in range(n - 2):
	if a[i + 1][0] > a[i][0]:
		if a[i + 2][1] > a[i + 1][1]:
			ans += 1
	elif a[i + 1][1] > a[i][1]:
		if a[i + 2][0] < a[i + 1][0]:
			ans += 1
	elif a[i + 1][0] < a[i][0]:
		if a[i + 2][1] < a[i + 1][1]:
			ans += 1
	elif a[i + 1][1] < a[i][1]:
		if a[i + 2][0] > a[i + 1][0]:
			ans += 1
print(ans)


n = int(input())
cnt = 0
lst = []
for i in range(n + 1):
	lst.append(list(map(int, input().split())))
	if i >= 2:
		(x1, y1) = lst[-3]
		(x2, y2) = lst[-2]
		(x3, y3) = lst[-1]
		if y3 > y2 and x2 > x1 or (y2 > y1 and x3 < x2) or (y2 < y1 and x3 > x2) or (y3 < y2 and x2 < x1):
			cnt += 1
print(cnt)


n = eval(input())
for i in range(n + 1):
	a = input()
print(int((n - 4) / 2))


X = int(input())
print('%.0f' % ((X - 4) * 0.5))


n = int(input())
for a in range(0, n + 1):
	z = input().split
m = n / 2 - 2
m = int(m)
print(m)


n = int(input())
p = [list(map(int, input().split())) for i in range(n + 1)]
ind = 0
res = 0
for i in range(1, n - 1):
	if p[i][1] > p[i - 1][1]:
		if p[i][0] > p[i + 1][0]:
			res += 1
	elif p[i][0] > p[i - 1][0]:
		if p[i][1] < p[i + 1][1]:
			res += 1
	elif p[i][0] < p[i - 1][0]:
		if p[i][1] > p[i + 1][1]:
			res += 1
	elif p[i][1] < p[i - 1][1]:
		if p[i][0] < p[i + 1][0]:
			res += 1
print(res)


n = int(input())
L = [list(map(int, input().split())) for i in range(n)]
l = [L[0][0], -1]
l1 = [L[0][1], -1]
k = 0
for x in L:
	l[1] = max(l[1], x[0])
	l1[1] = max(l1[1], x[1])
for i in range(1, n - 1):
	if L[i][0] - L[i - 1][0] != 0:
		if L[i][0] > L[i - 1][0] and L[i][1] < L[i + 1][1]:
			k += 1
		if L[i][0] < L[i - 1][0] and L[i][1] > L[i + 1][1]:
			k += 1
	if L[i][1] - L[i - 1][1] != 0:
		if L[i][1] < L[i - 1][1] and L[i][0] < L[i + 1][0]:
			k += 1
		if L[i][1] > L[i - 1][1] and L[i][0] > L[i + 1][0]:
			k += 1
print(k)


def main():
	n = int(input())
	nums = [tuple(map(int, input().split())) for _ in range(n + 1)]
	count = 0
	for ((x0, y0), (x1, y1), (x2, y2)) in zip(nums, nums[1:], nums[2:]):
		if x1 > x0 and y2 > y1 or (x1 < x0 and y2 < y1) or (y1 > y0 and x2 < x1) or (y1 < y0 and x2 > x1):
			count += 1
	print(count)
main()


pista = list()
num_retas = int(input())
for c in range(0, num_retas + 1):
	pista.append([int(i) for i in input().split()])
curvas = 0
curvas_perigo = 0
for i in range(0, num_retas + 1):
	if i > 0:
		if pista[i][0] > pista[i - 1][0]:
			curvas += 1
		elif pista[i][0] < pista[i - 1][0]:
			curvas += 1
		if pista[i][1] > pista[i - 1][1]:
			curvas += 1
		elif pista[i][1] < pista[i - 1][1]:
			curvas += 1
curvas_perigo = int(curvas - 4) / 2
print('{0:.0f}'.format(curvas_perigo))


import sys
n = int(sys.stdin.readline())
x = (n - 4) / 2
print(int(x))


n = int(input())
p = []
for _ in range(n + 1):
	(x, y) = map(int, input().split())
	p.append((x, y))

def cp(v1, v2):
	return v1[0] * v2[1] - v1[1] * v2[0]
answer = 0
for i in range(n - 1):
	v1 = (p[i + 1][0] - p[i][0], p[i + 1][1] - p[i][1])
	v2 = (p[i + 2][0] - p[i + 1][0], p[i + 2][1] - p[i + 1][1])
	if cp(v1, v2) > 0:
		answer += 1
print(answer)


n = int(input())
print(f'{(n - 4) / 2:.0f}')


n = int(input())
(sx, sy) = (int(x) for x in input().split())
(ax, ay) = (sx, sy)
(bx, by) = (int(x) for x in input().split())
(cx, cy) = (int(x) for x in input().split())
ans = 0
for i in range(n - 3):
	fx = bx - ax
	fy = by - ay
	lx = cx - bx
	ly = cy - by
	if fx != 0:
		fx = fx / abs(fx)
	if fy != 0:
		fy = fy / abs(fy)
	if lx != 0:
		lx = lx / abs(lx)
	if ly != 0:
		ly = ly / abs(ly)
	if fy == 1 and lx == -1:
		ans += 1
	if fx == 1 and ly == 1:
		ans += 1
	if fy == -1 and lx == 1:
		ans += 1
	if fx == -1 and ly == -1:
		ans += 1
	(ax, ay) = (bx, by)
	(bx, by) = (cx, cy)
	(cx, cy) = (int(x) for x in input().split())
fx = bx - ax
fy = by - ay
lx = cx - bx
ly = cy - by
if fx != 0:
	fx = fx / abs(fx)
if fy != 0:
	fy = fy / abs(fy)
if lx != 0:
	lx = lx / abs(lx)
if ly != 0:
	ly = ly / abs(ly)
if fy == 1 and lx == -1:
	ans += 1
if fx == 1 and ly == 1:
	ans += 1
if fy == -1 and lx == 1:
	ans += 1
if fx == -1 and ly == -1:
	ans += 1
(ax, ay) = (bx, by)
(bx, by) = (cx, cy)
(cx, cy) = (sx, sy)
fx = bx - ax
fy = by - ay
lx = cx - bx
ly = cy - by
if fx != 0:
	fx = fx / abs(fx)
if fy != 0:
	fy = fy / abs(fy)
if lx != 0:
	lx = lx / abs(lx)
if ly != 0:
	ly = ly / abs(ly)
if fy == 1 and lx == -1:
	ans += 1
if fx == 1 and ly == 1:
	ans += 1
if fy == -1 and lx == 1:
	ans += 1
if fx == -1 and ly == -1:
	ans += 1
print(ans)


n = int(input())
from sys import stdin
a = lambda : stdin.readline().split()
(x1, y1) = map(int, a())
(x2, y2) = map(int, a())
res = 0
for _ in range(n - 2):
	(x3, y3) = map(int, a())
	if x1 == x2 and y1 > y2 and (x3 > x2):
		res += 1
	if x1 == x2 and y1 < y2 and (x3 < x2):
		res += 1
	if y1 == y2 and x1 < x2 and (y3 > y2):
		res += 1
	if y1 == y2 and x1 > x2 and (y3 < y2):
		res += 1
	(x1, y1, x2, y2) = (x2, y2, x3, y3)
print(res)


def onde(antigo, recente):
	if int(antigo[0]) > int(recente[0]) and int(antigo[1]) == int(recente[1]):
		return 'w'
	if int(antigo[0]) < int(recente[0]) and int(antigo[1]) == int(recente[1]):
		return 'e'
	if int(antigo[0]) == int(recente[0]) and int(antigo[1]) < int(recente[1]):
		return 'n'
	if int(antigo[0]) == int(recente[0]) and int(antigo[1]) > int(recente[1]):
		return 's'

def turn_left(cardeal1, cardeal2):
	if cardeal1 == 'n' and cardeal2 == 'w':
		return True
	if cardeal1 == 'w' and cardeal2 == 's':
		return True
	if cardeal1 == 's' and cardeal2 == 'e':
		return True
	if cardeal1 == 'e' and cardeal2 == 'n':
		return True
n_straight_sections = int(input()) + 1
danger = 0
directions = []
recente = 'z'
for point in range(n_straight_sections):
	antigo = recente
	recente = input().split()
	if point < 1:
		continue
	directions.append(onde(antigo, recente))
for direction_idx in range(len(directions) - 1):
	if turn_left(directions[direction_idx], directions[direction_idx + 1]):
		danger += 1
print(danger)


def nummber_of_dang_curves(l):
	prev = 'N'
	counter = 0
	for i in range(1, len(l) - 1):
		(x, y) = (l[i][0], l[i][1])
		(v, w) = (l[i + 1][0], l[i + 1][1])
		if i % 2 == 0:
			if x + y > v + w:
				cur = 'S'
			else:
				cur = 'N'
		elif x + y > v + w:
			cur = 'W'
		else:
			cur = 'L'
		if prev + cur in ['WS', 'NW', 'SL', 'LN']:
			counter += 1
		prev = cur
	return counter
number_of_point = int(input())
l = []
for i in range(number_of_point + 1):
	l1 = list(map(int, input().rstrip().split()))
	l.append(l1)
print(nummber_of_dang_curves(l))


n = int(input())
coord = []
for i in range(n + 1):
	(x, y) = map(int, input().split())
	coord.append((x, y))

def direction(a, b):
	if a[0] == b[0]:
		if b[1] > a[1]:
			return 3
		else:
			return 1
	elif b[0] > a[0]:
		return 2
	else:
		return 4
dir1 = 0
count = 0
for i in range(n - 1):
	dir2 = direction(coord[i], coord[i + 1])
	if (dir2 - dir1) % 4 == 1:
		count += 1
	dir1 = dir2
print(count)


from enum import Enum

class Direction:
	NORTH = 0
	EAST = 1
	SOUTH = 2
	WEST = 3

def calculate_direction(x1, y1, x2, y2):
	if x2 - x1 > 0:
		return Direction.EAST
	elif x2 - x1 < 0:
		return Direction.WEST
	elif y2 - y1 > 0:
		return Direction.NORTH
	elif y2 - y1 < 0:
		return Direction.SOUTH
	else:
		raise RuntimeError('xd')
n = int(input())
points = []
for i in range(n + 1):
	(x, y) = [int(x) for x in input().split(' ')]
	points.append((x, y))
directions = []
for i in range(n):
	(x1, y1) = points[i]
	(x2, y2) = points[i + 1]
	directions.append(calculate_direction(x1, y1, x2, y2))
river_directions = [(d + 1) % 4 for d in directions]
dangerous_curves = 0
for i in range(len(directions)):
	if directions[i] == river_directions[(i + 1) % n]:
		dangerous_curves += 1
print(dangerous_curves)


n = int(input())
s = [int(z) for z in input().split()]
q2 = [int(z) for z in input().split()]
q1 = s
q3 = [int(z) for z in input().split()]
res = 0
while q2 != s:
	if q2[0] - q1[0] < 0 and q3[1] - q2[1] < 0:
		res += 1
	elif q2[0] - q1[0] > 0 and q3[1] - q2[1] > 0:
		res += 1
	elif q2[1] - q1[1] > 0 and q3[0] - q2[0] < 0:
		res += 1
	elif q2[1] - q1[1] < 0 and q3[0] - q2[0] > 0:
		res += 1
	if q3 != s:
		(q1, q2, q3) = (q2, q3, [int(z) for z in input().split()])
	else:
		q2 = s
print(res)


def clock(a, b, c):
	u = b - a
	v = c - b
	return u.real * v.imag - u.imag * v.real < 0
n = int(input())
p = []
for i in range(n + 1):
	(x, y) = map(int, input().split())
	p.append(complex(x, y))
cnt = 0
for i in range(1, n):
	if not clock(p[i - 1], p[i], p[i + 1]):
		cnt += 1
print(cnt)


t = int(input())
ans = []
for _ in range(t + 1):
	(a, b) = list(map(int, input().split()))
res = (t - 4) // 2
ans.append(res)
for i in ans:
	print(i)


n = int(input())
rc = []
for i in range(n + 1):
	rc.append([int(i) for i in input().split()])
rc1 = []
for i in range(n - 1):
	rc1.append([rc[i + 1][0] - rc[i][0], rc[i + 1][1] - rc[i][1]])
num = 0
for i in range(n - 2):
	if rc1[i][0] != 0:
		if rc1[i][0] * rc1[i + 1][1] > 0:
			num += 1
	elif rc1[i][1] * rc1[i + 1][0] < 0:
		num += 1
print(num)


t = int(input())
print((90 * t - 360) // 180)


tam = int(input())
perigo = 0
anterior = input().split()
atual = input().split()
s = l = o = False
n = True
anterior = atual
for i in range(0, tam - 1):
	atual = input().split()
	if n == True:
		if int(atual[0]) - int(anterior[0]) < 0:
			n = False
			perigo += 1
			o = True
		else:
			l = True
			n = False
	elif l == True:
		if int(atual[1]) - int(anterior[1]) > 0:
			l = False
			perigo += 1
			n = True
		else:
			l = False
			s = True
	elif o == True:
		if int(atual[1]) - int(anterior[1]) < 0:
			o = False
			perigo += 1
			s = True
		else:
			o = False
			n = True
	elif s == True:
		if int(atual[0]) - int(anterior[0]) > 0:
			s = False
			perigo += 1
			l = True
		else:
			s = False
			o = True
	anterior = atual
print(perigo)


n = int(input())
print(int(0.5 * (n - 4)))


(pts, ans) = (list(), 0)
n = int(input())
for _ in range(n + 1):
	pts.append([int(x) for x in input().split()])
for i in range(1, n):
	if pts[i][0] == pts[i - 1][0]:
		if pts[i][1] > pts[i - 1][1]:
			ans += pts[i + 1][0] < pts[i][0]
		else:
			ans += pts[i + 1][0] > pts[i][0]
	elif pts[i][0] < pts[i - 1][0]:
		ans += pts[i + 1][1] < pts[i][1]
	else:
		ans += pts[i + 1][1] > pts[i][1]
print(ans)


n = int(input())
mudamudamudamudamudamudamudamuda = [input() for i in range(n)]
print((n - 4) // 2)


n = int(input())
point = [0] * (n + 1)
for i in range(n + 1):
	point[i] = [int(x) for x in input().split()]
v = [0] * n
for i in range(1, n + 1):
	v[i - 1] = [point[i][0] - point[i - 1][0], point[i][1] - point[i - 1][1]]
ans = 0
for i in range(1, n - 1):
	if v[i - 1][0] * v[i][1] - v[i - 1][1] * v[i][0] > 0:
		ans += 1
if v[n - 1][0] * v[0][1] - v[n - 1][1] * v[0][0] > 0:
	ans += 1
print(ans)


n = int(input())
points = []
for i in range(n + 1):
	a = input().split()
	points.append([int(a[0]), int(a[1])])
d = 'c'
r = 0
for i in range(1, n + 1):
	x1 = points[i - 1][0]
	y1 = points[i - 1][1]
	x2 = points[i][0]
	y2 = points[i][1]
	if x2 > x1:
		if d == 'b':
			r += 1
		d = 'd'
	if x1 > x2:
		if d == 'c':
			r += 1
		d = 'e'
	if y2 > y1:
		if d == 'd':
			r += 1
		d = 'c'
	if y1 > y2:
		if d == 'e':
			r += 1
		d = 'b'
print(r)


n = int(input())
pts = [tuple(map(int, input().split())) for _ in range(n + 1)]
pts.pop()

def ccw(o, p, q):
	return (p[0] - o[0]) * (q[1] - o[1]) - (p[1] - o[1]) * (q[0] - o[0])
s = 0
for i in range(n):
	if ccw(pts[i - 2], pts[i - 1], pts[i]) > 0:
		s += 1
print(s)


import math

def get_n():
	return int(input())

def get_int_vector():
	return [int(x) for x in input().split()]

def list2string(list):
	result = []
	for i in list:
		result.append(str(i))
	return ':'.join(result)

def string2vector(string):
	return [int(x) for x in string.split(':')]
n = get_n()
print((n - 4) // 2)


import sys
run = int(sys.stdin.readline().strip())
cor = {}
for line in range(run):
	(x, y) = map(int, sys.stdin.readline().strip().split())
	cor[line] = (x, y)
count = 0
for elem in range(run - 2):
	x = cor[elem + 1][0] - cor[elem][0]
	y = cor[elem + 1][1] - cor[elem][1]
	x1 = cor[elem + 2][0] - cor[elem + 1][0]
	y1 = cor[elem + 2][1] - cor[elem + 1][1]
	if x * y1 - y * x1 > 0:
		count += 1
print(count)


print((eval(input()) - 4) // 2)


n = int(input())
xs = []
for _ in range(0, n + 1):
	xs.append(list(map(int, input().split(' '))))
count = 0
for i in range(0, n - 1):
	v1 = [xs[i + 1][0] - xs[i][0], xs[i + 1][1] - xs[i][1]]
	v2 = [xs[i + 2][0] - xs[i + 1][0], xs[i + 2][1] - xs[i + 1][1]]
	if v1[0] * v2[1] - v1[1] * v2[0] > 0:
		count += 1
print(count)


print(int(input()) // 2 - 2)


dx = [1, 0, -1, 0]
dy = [0, 1, 0, -1]
n = int(input())
p = [tuple(map(int, input().split())) for i in range(n + 1)]
v = []
for i in range(n):
	x = p[i + 1][0] - p[i][0]
	y = p[i + 1][1] - p[i][1]
	for j in range(4):
		if x * dx[j] + y * dy[j] > 0:
			v.append(j)
			break
v.append(v[0])
ans = 0
for i in range(n):
	ans += v[i + 1] == (v[i] + 1) % 4
print(ans)


n = int(input())
for i in range(n):
	(a, b) = map(int, input().split())
print((n - 4) // 2)


n = int(input())
k = 0
(a1, b1) = [int(x) for x in input().split()]
(a2, b2) = [int(x) for x in input().split()]
for i in range(n - 1):
	(a3, b3) = [int(x) for x in input().split()]
	if a2 - a1 > 0 and b3 - b2 > 0:
		k += 1
	if a2 - a1 < 0 and b3 - b2 < 0:
		k += 1
	if b2 - b1 > 0 and a3 - a2 < 0:
		k += 1
	if b2 - b1 < 0 and a3 - a2 > 0:
		k += 1
	a1 = a2
	b1 = b2
	b2 = b3
	a2 = a3
print(k)


n = int(input())
(x_b, y_b) = list(map(int, input().split()))
dif_b = 0
cnt = 0
for i in range(n - 1):
	(x, y) = list(map(int, input().split()))
	if x > x_b:
		dif = 1
	elif x < x_b:
		dif = 3
	elif y > y_b:
		dif = 0
	elif y < y_b:
		dif = 2
	if dif_b == 1 and dif == 0 or (dif_b == 0 and dif == 3) or (dif_b == 3 and dif == 2) or (dif_b == 2 and dif == 1):
		cnt += 1
	x_b = x
	y_b = y
	dif_b = dif
print(cnt)


pontos = int(input())
x = []
y = []
cont = 0
for i in range(pontos + 1):
	ponto = input().split(' ')
	x.append(int(ponto[0]))
	y.append(int(ponto[1]))
for i in range(1, pontos - 1):
	if x[i - 1] < x[i] and y[i] < y[i + 1]:
		cont += 1
	elif y[i - 1] < y[i] and x[i] > x[i + 1]:
		cont += 1
	elif x[i - 1] > x[i] and y[i] > y[i + 1]:
		cont += 1
	elif y[i - 1] > y[i] and x[i] < x[i + 1]:
		cont += 1
print(cont)


n = int(input())
a = []
tr = 0
tl = 0
for i in range(0, n + 1):
	p = input().split()
	p[0] = int(p[0])
	p[1] = int(p[1])
	a.append(p)
a.append(a[0])
for i in range(0, n):
	x1 = a[i + 1][0] - a[i][0]
	y1 = a[i + 1][1] - a[i][1]
	x2 = a[i + 2][0] - a[i + 1][0]
	y2 = a[i + 2][1] - a[i + 1][1]
	if x1 > 0:
		if y2 > 0:
			tl += 1
		else:
			tr += 1
	elif x1 < 0:
		if y2 < 0:
			tl += 1
		else:
			tr += 1
	elif y1 > 0:
		if x2 < 0:
			tl += 1
		else:
			tr += 1
	elif x2 > 0:
		tl += 1
	else:
		tr += 1
print(str(min(tl, tr)))


n = int(input())
p1 = tuple(map(int, input().split()))
p2 = tuple(map(int, input().split()))
count = 0
for x in range(n - 1):
	p3 = tuple(map(int, input().split()))
	x1 = p2[0] - p1[0]
	y1 = p2[1] - p1[1]
	x2 = p3[0] - p2[0]
	y2 = p3[1] - p2[1]
	if x1 * y2 > x2 * y1:
		count += 1
	p1 = p2
	p2 = p3
print(count)


def cross_product(u, v):
	return u[0] * v[1] - u[1] * v[0]
n = int(input())
counter = 0
(x0, y0) = [int(x) for x in input().split()]
(x1, y1) = [int(x) for x in input().split()]
v1 = (x1 - x0, y1 - y0)
for i in range(n - 1):
	(x0, y0, v0) = (x1, y1, v1)
	(x1, y1) = [int(x) for x in input().split()]
	v1 = (x1 - x0, y1 - y0)
	if cross_product(v0, v1) > 0:
		counter += 1
print(counter)


n = int(input())
for i in range(n):
	a = input()
print((n - 4) // 2)


n = int(input())
for i in range(n + 1):
	(x, y) = map(int, input().split())
print((n - 4) // 2)


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()) // 2 - 2
print(n)


def transform(x):
	return int(x)

def checkDangerousTurn(secao1, secao2, secao3):
	(x1, y1) = secao1
	(x2, y2) = secao2
	(x3, y3) = secao3
	if (y1 < y2 and x1 == x2) and (x2 > x3 and y2 == y3):
		return True
	if (y1 == y2 and x1 < x2) and (x2 == x3 and y2 < y3):
		return True
	if (y1 == y2 and x1 > x2) and (x2 == x3 and y2 > y3):
		return True
	if (y1 > y2 and x1 == x2) and (x2 < x3 and y2 == y3):
		return True
	return False
n = int(input())
par_de_secoes = []
trio_secoes = []
inicioefim = ()
quantidadeCurvasPerigosas = 0
i = 0
while i < n + 1:
	i += 1
	entrada = tuple(map(transform, input().split()))
	par_de_secoes.insert(len(par_de_secoes), entrada)
	if i == 1:
		inicioefim = entrada
for secao in par_de_secoes:
	if len(trio_secoes) == 3:
		if checkDangerousTurn(trio_secoes[0], trio_secoes[1], trio_secoes[2]):
			quantidadeCurvasPerigosas += 1
		trio_secoes[0] = trio_secoes[1]
		trio_secoes[1] = trio_secoes[2]
		trio_secoes[2] = secao
		if secao == inicioefim:
			if checkDangerousTurn(trio_secoes[0], trio_secoes[1], trio_secoes[2]):
				quantidadeCurvasPerigosas += 1
	else:
		trio_secoes.insert(len(trio_secoes), secao)
print(quantidadeCurvasPerigosas)


n = int(input())
(right, left) = (0, 0)
(x1, y1) = map(int, input().split())
(x2, y2) = map(int, input().split())
for _ in range(n - 1):
	(x3, y3) = map(int, input().split())
	ans = (y2 - y1) * (x3 - x2) - (x2 - x1) * (y3 - y2)
	if ans > 0:
		right += 1
	elif ans < 0:
		left += 1
	(x1, y1) = (x2, y2)
	(x2, y2) = (x3, y3)
print(min(right, left))


import sys
input = sys.stdin.readline
n = int(input())
(x1, y1) = (int(x) for x in input().split())
(x2, y2) = (int(x) for x in input().split())
d = 'north'
turns = 0
for i in range(n - 1):
	(tx, ty) = (int(x) for x in input().split())
	(dx, dy) = (tx - x2, ty - y2)
	if dx > 0:
		if d == 'south':
			turns += 1
		d = 'east'
	elif dx < 0:
		if d == 'north':
			turns += 1
		d = 'west'
	elif dy > 0:
		if d == 'east':
			turns += 1
		d = 'north'
	elif dy < 0:
		if d == 'west':
			turns += 1
		d = 'south'
	(x2, y2) = (tx, ty)
print(turns)


n = int(input())
(px2, py2) = map(int, input().split())
(px, py) = map(int, input().split())
ans = 0
for i in range(2, n):
	(x, y) = map(int, input().split())
	x1 = x - px
	y1 = y - py
	x2 = px - px2
	y2 = py - py2
	if x2 > 0 and y1 > 0 or (y2 < 0 and x1 > 0) or (x2 < 0 and y1 < 0) or (y2 > 0 and x1 < 0):
		ans += 1
	py2 = py
	px2 = px
	px = x
	py = y
print(ans)


from sys import stdin, stdout
n = int(stdin.readline().strip())
s = [list(map(int, stdin.readline().strip().split())) for i in range(n + 1)]
s.append(s[1])
s.append(s[2])
ans = 0
for i in range(n):
	if s[i + 1][1] > s[i][1] and s[i + 2][0] < s[i + 1][0]:
		ans += 1
	elif s[i + 1][1] < s[i][1] and s[i + 2][0] > s[i + 1][0]:
		ans += 1
	elif s[i + 1][0] > s[i][0] and s[i + 2][1] > s[i + 1][1]:
		ans += 1
	elif s[i + 1][0] < s[i][0] and s[i + 2][1] < s[i + 1][1]:
		ans += 1
print(ans)


n = int(input())
coordenates = []
for _ in range(n + 1):
	d = input().split()
	coordenates.append([int(d[0]), int(d[1])])
direction = 'N'
coordenates.append(coordenates[1])
counter = 0
for p in range(1, len(coordenates) - 1):
	if direction == 'N' and coordenates[p][0] > coordenates[p + 1][0]:
		direction = 'O'
		counter += 1
	elif direction == 'L' and coordenates[p][1] < coordenates[p + 1][1]:
		direction = 'N'
		counter += 1
	elif direction == 'S' and coordenates[p][0] < coordenates[p + 1][0]:
		direction = 'L'
		counter += 1
	elif direction == 'O' and coordenates[p][1] > coordenates[p + 1][1]:
		direction = 'S'
		counter += 1
	elif direction == 'N':
		direction = 'L'
	elif direction == 'L':
		direction = 'S'
	elif direction == 'O':
		direction = 'N'
	elif direction == 'S':
		direction = 'O'
	current = p
print(counter)


from functools import reduce

def vec_sum(*vecs):
	return tuple(map(sum, list(zip(*vecs))))

def vec_neg(v):
	return tuple(map(lambda x: -x, v))

def vec_normal(v):
	return (-v[1], v[0])

def vec_dot_product(*vecs):
	return sum(map(lambda nums: reduce(lambda x, y: x * y, nums), zip(*vecs)))

def bicycle_race(points):
	vectors = [vec_sum(points[i + 1], vec_neg(points[i])) for i in range(len(points) - 1)]
	n = 0
	for (i, vector) in enumerate(vectors[:-1]):
		next_vector = vectors[i + 1]
		next_vector_normal = vec_normal(next_vector)
		dot_prod = vec_dot_product(vector, next_vector_normal)
		if dot_prod < 0:
			n += 1
	return n
n_points = int(input()) + 1
points = [tuple(map(int, input().split())) for i in range(n_points)]
print(bicycle_race(points))


n = int(input())
points_x = []
points_y = []
for i in range(n + 1):
	(xi, yi) = [int(a) for a in input().split()]
	points_x.append(xi)
	points_y.append(yi)
current_dir = 'N'
(min_x, min_y) = (points_x[0], points_y[0])
(max_x, max_y) = (max(points_x), max(points_y))
dang = 0
for i in range(len(points_x) - 2):
	(cx, cy) = (points_x[i], points_y[i])
	(nx, ny) = (points_x[i + 1], points_y[i + 1])
	(nnx, nny) = (points_x[i + 2], points_y[i + 2])
	if nx == nnx:
		if nny > ny:
			next_dir = 'N'
		else:
			next_dir = 'S'
	elif ny == nny:
		if nnx > nx:
			next_dir = 'E'
		else:
			next_dir = 'W'
	if current_dir == 'N':
		if next_dir in ['N', 'W']:
			dang += 1
	if current_dir == 'E':
		if next_dir in ['N', 'E']:
			dang += 1
	if current_dir == 'S':
		if next_dir in ['S', 'E']:
			dang += 1
	if current_dir == 'W':
		if next_dir in ['W', 'S']:
			dang += 1
	current_dir = next_dir
print(dang)


n = int(input())
x = n
while x != -1:
	input()
	x -= 1
print(int((n - 4) / 2))