Maps

No attempts yetTime limit1sMemory limit128 MB

Problem

Bajtazar owns a large collection of maps of Poland. Some are road maps, others are tourist maps, and so on. Every map has the shape of a rectangle, and a map may be rotated arbitrarily. Each map carries useful information about various places across the country.

Standing at a particular point, Bajtazar would like that point to appear on every one of his maps at once. He therefore wonders about the shape of the region that all the maps have in common. This common region is always a convex polygon, and your only task is to determine how many edges it has.

Task

  • Read the list of rectangles describing the area covered by each map.
  • Print the number of edges of the polygon formed by the common region of these rectangles.

Input

The first line contains one integer nn (1n1061 \le n \le 10^6), the number of rectangles.

Each of the next nn lines describes one rectangle with eight integers separated by single spaces: the coordinate pairs (x1,y1) (x2,y2) (x3,y3) (x4,y4)(x_1, y_1)\ (x_2, y_2)\ (x_3, y_3)\ (x_4, y_4) of its four vertices listed in counter-clockwise order. Every coordinate satisfies 1x,y1041 \le x, y \le 10^4.

You may assume that the area of the common region of all the rectangles is strictly greater than 00.

Output

Print a single integer: the number of edges of the polygon formed by the common region of the rectangles.

Hint