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), Jane defines four areas:
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.
The first line contains two integers n and d (1≤n≤1,000,000, 3≤d≤109): the number of marked points and the size of the map. Each of the next n lines contains two integers xi and yi (0≤xi≤d, 0≤yi≤d), the coordinates of the i-th point. All points are distinct.
Print a single integer: the number of marked points that can be chosen as the starting point.
