eolymp
bolt
Try our new interface for solving problems
Problems

Beam in Tunnel

Beam in Tunnel

Time limit 1 second
Memory limit 64 MiB

A tunnel with square profile consists of (n-1) sections. Floor in each section is flat and can go up or down along the section. Coordinates [x_1, y_1 ], [x_2 , y_2 ], ..., [x_n , y_n ] where x_1 < x_2 < ... < x_n describe points where tunnel’s floor starts, ends, or one section joins other. Ceiling of the tunnel is 1 meter above the floor and corresponding sections’ join points are at coordinates [x_i, y_i + 1].

Laser beam is directed to the tunnel from its start. To facilitate beam transition through the tunnel light translators could be installed at section boundaries. These translators can retransmit laser emission in necessary direction, moreover retransmitted beam not necessarily starts at the point where coming beam hit the translator.

As soon as light translators could be installed at sections boundaries only, their coordinates can only be x_1 , x_2 , ..., x_n . Your task is to determine the minimal number of light translators necessary to allow bean transition through the tunnel.

Input data

The first line at input contains integer N (2N1000). Following N lines contain 2 floats each – coordinates x_i and y_i (-10000x_i, y_i10000).

Output data

The only line at output should contain one integer – the minimal number of light translators necessary.

Examples

Input example #1
4
1 1
2 1
3 2
4 1
Output example #1
1