AlgoUniversity
  • Go Back
Discussion
Elections :

Author

Akshay Sharma

Difficulty Level : Medium

Submissions : 311

Asked In : Walmart

Marks :100

: 1 | : 5

X and Y were in an election battle in their city. The city contains N towns and each town has M1 number of people who will vote for Y and M2 number of people who will not take part in the election. X after seeing the lack of his supporters decided to campaign.

If X does a campaign in town T both M1 and M2 people in that town become his supporters.

Your task is to calculate the least number of towns in which X has to campaign to win the election.

Input

The first line contains N ($$$ 1 \le N \le 2*10^5 $$$).

The next N number of lines contains pairs {m1 and m2}($$$1 \le M1,M2 \le 10^9$$$).

Output

For each test case print the least number of towns in which X has to campaign to win

Examples

Input
4
2 1
2 2
5 1
1 3
Output
1
Input
2
2 2
2 2
Output
1

Note

It's always possible for X to win the election

You need to login to view your submissions.

You need to login to view all submissions.

Loading...

Result : Executed

Loading...

Feel something is wrong with the test cases?

Result : Accepted

Test Cases :

You need to Log In
We're glad that you want to attempt this problem!

But to Run or Submit the Problem, you need to Log In.

Continue to Log In
Challenge Submitted!

Your challenge has been submitted successfully.

You will get a response soon via WhatsApp or Email.

Challenge
Facing issue while trying to solve the problem! Don't worry, we got you covered!

Do let us know your issue.

Looks good!
Please enter your issue / feedback.

How do we get in touch with you?
Looks good!
Please enter your phone no.
Looks good!
Please enter your email address.