# 灯塔(LightHouse)

### Description

As shown in the following figure, If another lighthouse is in gray area, they can beacon each other.

For example, in following figure, (B, R) is a pair of lighthouse which can beacon each other, while (B, G), (R, G) are NOT.

### Input

1st line: N

2nd ~ (N + 1)th line: each line is X Y, means a lighthouse is on the point (X, Y).

### Output

How many pairs of lighthourses can beacon each other

( For every lighthouses, X coordinates won’t be the same , Y coordinates won’t be the same )

### Example

Input

3
2 2
4 3
5 1


Output

1


### Restrictions

For 90% test cases: 1 <= n <= 3 * 105

For 95% test cases: 1 <= n <= 106

For all test cases: 1 <= n <= 4 * 106

For every lighthouses, X coordinates won’t be the same , Y coordinates won’t be the same.

1 <= x, y <= 10^8

Time: 2 sec

Memory: 256 MB

### Hints

The range of int is usually [-231, 231 – 1], it may be too small.

（图一）

（图二）

### 输出

1个整数，表示可照亮彼此的灯塔对的数量。

1 ≤ x, y ≤ 10^8

### 提示

 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970 #include #include using namespace std; struct point{     int x;     int y; }; void Merge(int *a,int s,int m,int e,int *b){     int ptr1=s,ptr2=m+1,ptr=s;     while (ptr1<=m&&ptr2<=e){         if (a[ptr1]x-((point *)v2)->x; } int main(){     int n;     cin>>n;     point * arrayp=new point[n];     for(int i=0;i>arrayp[i].x>>arrayp[i].y;     }     qsort(arrayp,n,sizeof(point),cmp);     int * array=new int[n];     int * array2=new int[n];     for(int i=0;i