n = int(input()) points = [[int(i) for i in input().split()] for _ in range(n+1)] left = [ ((-1, 0), (0, -1)), ((0, -1), (1, 0)), ((1, 0), (0, 1)), ((0, 1), (-1, 0)) ] right = [(p2, p1) for p1, p2 in left] dangerous_turns = 0 def signe(n): if n == 0: return 0 if n > 0: return 1 return -1 def normalized(x1, y1, x2, y2, x3, y3): return ((signe(x2-x1), signe(y2-y1)), (signe(x3-x2), signe(y3-y2))) def danger(initial_turn, p1, p2, p3): norm = normalized(*p1, *p2, *p3) if (initial_turn and norm in left) or (not initial_turn and norm in right): return False return True initial_turn = normalized(*points[-2], *points[0], *points[1]) in left #print("initial:", normalized(*points[-2], *points[0], *points[1]), initial_turn) for i in range(1, n): if danger(initial_turn, points[i-1], points[i], points[i+1]): dangerous_turns += 1 print(dangerous_turns)