403222: GYM101081 E Polish Fortress

Memory Limit:256 MB Time Limit:2 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

E. Polish Fortresstime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard output

The Malbork castle is the largest brick castle in the world. It was built in 1274 in honor to Holy Mary, and is located near the river Nogat, in Poland. During World War II it was totally destroyed. In this times it was discovered that the castle was actually built in many phases, and it was surrounded by a fortress and a wall centuries after it had began building.

In those times wall building was a very elaborate task. War tactics showed that it was convenient to build niches in the walls, that is, a recess on them. In these niches a soldier could stand in relative safety, since he could see all the area determined by the line segments in the niche without needing to turn his head (it was considered they field of vision of 180 degrees). The more niches a wall had, the safer the fortress was considered.

Your task in this problem is, given N points, the corners of the fortress, determine how many of them are niches as described above, in which soldiers could stand to protect the castle.

Input

The first line has an integer N, the number of corners of the fortress. Each of the next N lines has two integers Xi and Yi, the coordinates of a fortress corner. The corners are given in clockwise or counterclockwise order. There are no three consecutive colinear points and the wall does not intersect itself.

Limits

  • 3 ≤ N ≤ 105
  • |X|, |Y| ≤ 1.8·104
Output

Print a single integer, the number of niches in the fortress.

ExamplesInput
13
0 0
700 100
400 500
1300 600
700 400
1400 200
2200 1200
1500 2000
1500 1700
400 1700
400 2200
0 1900
10 1000
Output
5
Input
3
-32 45
2 19
-100 -3
Output
0
Note

The image shows the first example.

Source/Category

加入题单

上一题 下一题 算法标签: