시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 128 MB150067755047.743%

문제

콘도를 선정할 때에는 가급적이면 싸고 바닷가에 가까운 곳으로 하려 한다. 이를 위해 우선 적당한 콘도 몇 곳을 후보로 선정하려 하는데, 다음 두 조건을 만족하는 콘도 X가 후보가 된다.

  1. X보다 바닷가에 더 가까운 콘도들은 모두 X보다 숙박비가 더 비싸다.
  2. X보다 숙박비가 더 싼 콘도들은 모두 X보다 바닷가에서 더 멀다.

각 콘도의 바닷가에서의 거리와 숙박비에 대한 정보가 주어졌을 때, 후보 콘도의 개수를 구해내는 프로그램을 작성하시오.

입력

첫째 줄에 콘도의 개수를 나타내는 자연수 N(1 ≤ N ≤ 10,000)이 주어진다. 다음 N개의 줄에는 각 콘도에 대한 정보를 나타내는 두 정수 D(1 ≤ D ≤ 10,000), C(1 ≤ C ≤ 10,000)가 주어진다. D는 그 콘도의 바닷가로부터의 거리를 나타내고, C는 그 콘도의 숙박비를 나타낸다. 서로 다른 두 콘도의 D 값과 C값이 모두 같은 입력은 주어지지는 않는다.

출력

첫째 줄에 후보가 될 수 있는 콘도의 수를 출력한다.

예제 입력 1

5
300 100
100 300
400 200
200 400
100 500

예제 출력 1

2
W3sicHJvYmxlbV9pZCI6IjIyNDYiLCJwcm9ibGVtX2xhbmciOiIwIiwidGl0bGUiOiJcdWNmNThcdWIzYzQgXHVjMTIwXHVjODE1IiwiZGVzY3JpcHRpb24iOiI8cD5cdWNmNThcdWIzYzRcdWI5N2MgXHVjMTIwXHVjODE1XHVkNTYwIFx1YjU0Y1x1YzVkMFx1YjI5NCBcdWFjMDBcdWFlMDlcdWM4MDFcdWM3NzRcdWJhNzQgXHVjMmY4XHVhY2UwIFx1YmMxNFx1YjJmN1x1YWMwMFx1YzVkMCBcdWFjMDBcdWFlNGNcdWM2YjQgXHVhY2YzXHVjNzNjXHViODVjIFx1ZDU1OFx1YjgyNCBcdWQ1NWNcdWIyZTQuIFx1Yzc3NFx1Yjk3YyBcdWM3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