Check List
题号:NC223541
时间限制:C/C++/Rust/Pascal 5秒,其他语言10秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

When test driving a vehicle, you are asked to make a checkmark on a tablet. Upon inspection, you have noticed many fingerprints on the screen. Aside from the rush of disgust, you notice that the fingerprints on the screen can be represented by a series of 2D points on a standard Cartesian grid. You know that checkmarks can be uniquely defined by three points; these three points have distinct x coordinates and the three points also have distinct y coordinates. The leftmost point must be lower than the rightmost point and higher than the middle point. Now you want to know how many unique checkmarks you can make using the 2D points. 

Let’s consider some examples. The three points (1,2), (2,1), and (3,2) do not form a valid checkmark because the leftmost and rightmost points are at the same height. The three points (1,2), (2,1), and (2,3) do not form a valid checkmark because two points have the same x coordinates. The three points (1,2), (3,1), and (4,9) do form a valid checkmark.

Given a list of 2D points, determine the number of unique checkmarks that can be formed from them.

输入描述:

The first input line contains a single integer, n (1 ≤ n ≤ 100,000), representing the number of points. Each of the following n input lines contains two integers, xi and yi (1 ≤ xi, yi ≤1,000,000,000), representing the location of a point on the 2D grid. No two points will be identical.

输出描述:

Print the number of distinct checkmarks that can be formed by the given 2D points. 
示例1

输入

复制
6 
6 6
5 3
1 5
3 2
4 4
2 1

输出

复制
5
示例2

输入

复制
10
4 2
9 4
1 5
2 4
10 5
6 1
3 3
8 3
5 1
7 2

输出

复制
20