Bajtazar bought a pair of scissors. To try them out he grabbed a polygon lying nearby and decided to cut it into rectangles, using as few cuts as possible. Help Bajtazar and compute how many cuts he will need to make.
The polygon consists only of vertical and horizontal segments. Before picking up the scissors, Bajtazar draws some vertical and horizontal segments on the polygon. The two endpoints of each drawn segment lie on the boundary of the polygon, and the interior of each segment lies inside the polygon. He then cuts the polygon along every drawn segment. The number of cuts equals the number of drawn segments. After all the cuts are made, every resulting piece must be a rectangle.
Note that after some cuts have been made, one of the drawn segments may itself already have been split into several parts; cutting along all of the parts that come from a single drawn segment still counts as one cut. In particular, this means that a 2×2 square can be divided into four 1×1 squares with only two cuts (although, given Bajtazar's goal, such cutting makes no sense).
The first line contains a single integer n (4≤n≤100000), the number of vertices of the polygon. Each of the next n lines describes one vertex; the vertices are given in the order in which they appear along the boundary. The i-th vertex is described by a pair of integers xi, yi (−109≤xi,yi≤109), its coordinates.
Every side of the polygon is vertical or horizontal. Two sides of the polygon intersect only when they are consecutive sides along the boundary, in which case their only common point is the shared vertex. In particular, the coordinates of all vertices are pairwise distinct.
Print the minimum number of cuts needed to divide the polygon into rectangles.

The figure shows a few possible ways to divide the polygon above into rectangles using two cuts.