GPA
题号:NC216041
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld

题目描述

In this term, Alice took courses. Now, she has finished all final exams, and she will get her grades in the following days.

On the i-th day, Alice will know her grade of the i-th course, denoted as A_i. If A_i is strictly less than the average grade of the first courses, Alice will be sad on that day.

Now Bob hacks into the school's database. Bob can choose a set of courses ( can be empty), and then for each course in , change Alice's grade from A_i to B_i.

Bob wants to minimize the number of days that Alice will be sad. Now you need to help him to decide which courses' grades he should modify.

Note: Alice is always happy on the first day. 

输入描述:

The first line contains one single integer .

Then lines follow. The i-th line contains 2 integers A_i, B_i.

The input guarantees that .

输出描述:

Output the minimum number of the days that Alice will be sad.
示例1

输入

复制
4
1 2
2 3
1 2
1 1

输出

复制
1