Polygon Guards

No attempts yetTime limit5sMemory limit128 MB

Problem

You are an IT system administrator in the Ministry of Defense of Polygon Country.

The border of Polygon Country is a polygon with NN vertices. Drawn on the plane, every vertex sits on a lattice point and every edge is parallel to the xx axis or the yy axis.

To keep enemies out, a very strong defense wall runs along the whole border. A vertex is where two walls meet, so it has a structural weakness that cannot be removed. Enemies therefore attack and invade at the vertices.

To watch the vertices and notice an invasion as early as possible, the ministry decided to hire guards. Guards stand on vertices only, and they are placed so that every vertex is watched by at least one of them. A guard at vertex AA can watch vertex BB if the whole segment joining AA and BB lies inside the polygon or on its edges. A guard also watches the vertex he or she stands on. One guard watches every vertex he or she can watch at the same time.

The ministry wants to cut the defense cost, so it wants the number of guards to be as small as possible. Compute the minimum number of guards needed to watch all vertices of Polygon Country.

Input

The input is formatted as follows.

N
X1 Y1
:
:
XN YN

The first line contains an even integer NN (4N<404 \le N < 40).

Each of the next NN lines describes one vertex of the polygon with two integers XiX_i and YiY_i separated by one space (1iN1 \le i \le N, Xi1000\lvert X_i \rvert \le 1000, Yi1000\lvert Y_i \rvert \le 1000). The ii-th vertex is at (Xi,Yi)(X_i, Y_i).

If ii is odd, then Xi=Xi+1X_i = X_{i+1} and YiYi+1Y_i \ne Y_{i+1}. If ii is even, then XiXi+1X_i \ne X_{i+1} and Yi=Yi+1Y_i = Y_{i+1}. Here XN+1=X1X_{N+1} = X_1 and YN+1=Y1Y_{N+1} = Y_1.

The vertices are given in counterclockwise order in the coordinate system where the xx axis points right and the yy axis points up. The polygon is simple, so an edge shares no point with any other edge except the endpoints it shares with its two neighbors.

Output

Print the minimum number of guards on one line.