Four Points

Time limit3sMemory limit256 MB

Problem

Mike is a magician. One of his inventions is a labyrinth that grants supernatural abilities to everyone who walks through it. Its internal structure is extremely complicated, yet from the outside it is simply a square drawn on the ground.

Mike found a suitable place for the labyrinth on the seashore. He drew the square's border in the sand and marked four points with small stones, so that each side of the square contained exactly one stone and no stone lay at a corner.

Drawings in sand do not last, and after a while Mike could find only the four stones in their places. He wonders whether the marked square could have existed at all — that is, whether there is any square whose four sides each contain exactly one of the stones in the interior, with no stone at a corner. Treat the seashore as a plane and the stones as points on it.

Given the positions of the four stones, decide whether such a square exists.

Input

Four lines follow; the $i$-th of them contains two integers $x_i$ and $y_i$ — the coordinates of the $i$-th stone ($-1000 \le x_i, y_i \le 1000$). No two stones coincide, and no three stones are collinear.

Output

Print a single line containing $1$ if there exists a square such that each of its four sides contains exactly one stone in its interior (no stone at a corner), or $0$ if no such square exists.