gcx is playing a game in which you need to link two of the towers to gain experience. Since each link of two towers will get the same experience, and each tower can establish link with any amount of towers. gcx wants to link all the towers which can be connect. She puts all the towers on a coordinate system, for any two towers, if there is a rectangle which is parallel to the axis of the coordinate system and this rectangle is containing only these two towers, gcx can connect them. (Containing means located inside the rectangle or on the edge) There are n towers on the coordinate system, gcx want to know how much pair of tower she can link at most. Can you help her to solve this problem?

## 1174: Links

时间限制: 1 Sec 内存限制: 128 MB提交: 16 解决: 4

[提交][状态][讨论版]

## 题目描述

## 输入

The first line of the input contains a single integer n (1 ≤ n ≤ 100000), the number of towers in the coordinate system. followed by n lines, the i-th line (1 ≤ i ≤ n) contains two integers xi and yi (|xi|,|yi| ≤ 1e9), separated by a space, (x, y) is the location of the i-th tower.

## 输出

One line contains a single integer, the number of pair of towers gcx can link at most.

## 样例输入

```
4
1 1
1 -1
-1 1
-1 -1
```

## 样例输出

```
4
```

## 提示

## 来源

한국어
中文
فارسی
English
ไทย

Anything about the Problems, Please Contact Admin:admin

All Copyright Reserved 2010-2021 Xidian Programming Contest Online Judge TEAM

GPL2.0 2003-2014 HUSTOJ Project TEAM

Anything about the Problems, Please Contact Admin:admin

All Copyright Reserved 2010-2021 Xidian Programming Contest Online Judge TEAM

GPL2.0 2003-2014 HUSTOJ Project TEAM