Tractor

No attempts yetTime limit1sMemory limit128 MB

Problem

After a long day of work, Farmer John forgot that he left his tractor in the middle of the field. His mischievous cows decide to play a prank on him: they drop $N$ bales of hay ($1 \le N \le 50{,}000$) at various spots in the field so that Farmer John cannot easily get the tractor out without first removing some of the bales.

The tractor's position and the positions of the $N$ hay bales are all points in the 2D plane with integer coordinates in the range $1$ to $1000$. No hay bale sits on the tractor's starting point. When Farmer John drives the tractor he may only move it parallel to the coordinate axes (north, south, east, west), and each move must be an integer number of units — for example, he might go $2$ units north and then $3$ units east. The tractor may never move onto a point occupied by a hay bale.

Determine the minimum number of hay bales Farmer John must remove so that he can drive the tractor to the origin $(0, 0)$ of the plane.

Input

  • Line 1: Three space-separated integers — the number of bales $N$ and the tractor's starting coordinates $x$ and $y$.
  • Lines 2 to $N+1$: Each line gives the coordinates $x$ and $y$ of one hay bale.

Output

  • Line 1: The minimum number of hay bales Farmer John must remove so the tractor can reach the origin $(0, 0)$.