Wire Crossing

No attempts yetTime limit2sMemory limit128 MB

Problem

In a two-dimensional hardware layout, crossing wires need expensive gadgets. You are given mm existing straight wires and a new connection from (x0,y0)(x_0, y_0) to (x1,y1)(x_1, y_1). The new connection need not be straight, but it may not pass through a point where two or more existing wires already meet.

The start and end points do not lie on an existing wire. Each pair of wires meets in at most one point, and wires do not overlap. Find the minimum number of existing wires that must be crossed, and print that number.

Input

A single test case is given.

  • Line 1: mm, x0x_0, y0y_0, x1x_1, y1y_1 (m100m \le 100)
  • Next mm lines: one existing wire from (xa,ya)(x_a, y_a) to (xb,yb)(x_b, y_b)

Every coordinate has absolute value less than 10510^5.

Output

Print the minimum number of existing wires that must be crossed to connect the start and end points.