Map

No attempts yetTime limit1sMemory limit128 MB

Problem

Jane found an old map of her town in the basement. The map is a square sheet of paper divided into unit squares, and several mysterious points are marked on it. Jane does not know what the points mean, so she decided to visit every one of them. She will meet three colleagues, Jack, Adam, and Robert, at one of the marked points, and that point becomes the starting point. Each of the four people is then assigned an area and visits all of the mysterious points inside it.

Relative to the starting point (x0,y0)(x_0, y_0), Jane defines four areas:

  • Area 1: every point whose first and second coordinates are both smaller than the starting point (x<x0x < x_0 and y<y0y < y_0).
  • Area 2: every point whose first and second coordinates are both larger (x>x0x > x_0 and y>y0y > y_0).
  • Area 3: every point whose first coordinate is larger and second coordinate is smaller (x>x0x > x_0 and y<y0y < y_0).
  • Area 4: every point whose first coordinate is smaller and second coordinate is larger (x<x0x < x_0 and y>y0y > y_0).

Finally, all four visit together the marked points whose first or second coordinate equals the matching coordinate of the starting point.

Jane wants to pick the starting point so that each of the four people has at least one mysterious point to visit on their own, meaning all four areas are non-empty. Count how many of the marked points can serve as such a starting point.

Input

The first line contains two integers nn and dd (1n1,000,0001 \le n \le 1{,}000{,}000, 3d1093 \le d \le 10^9): the number of marked points and the size of the map. Each of the next nn lines contains two integers xix_i and yiy_i (0xid0 \le x_i \le d, 0yid0 \le y_i \le d), the coordinates of the ii-th point. All points are distinct.

Output

Print a single integer: the number of marked points that can be chosen as the starting point.

Hint