Artificial Intelligence
That AI exam was brutal, wasn't it? As the University of Adelaide's newest AI lecturer, these test scores aren't looking great. If you handed these over to the academic board, they'd tear you to shreds! You need to find a way to look less like a failure.
You can't just give everyone points, that'd raise way too many eyebrows. But maybe you could shuffle them around? Take some marks from the top scorers and give them to the ones struggling. Who could tell?
The exam is out of points, and a student needs
to pass. What's the highest number of students you can make pass by redistributing their points?
Input
The first line contains an integer, (
), the number of students who took the AI exam.
The next line contains integers
(
), the score of the
th student who took the exam.
Output
Output the number of students who could pass the exam, by redistributing their marks while keeping their total score the same.
Example
Input 1
4
65 40 20 60
Output 1
3
Take marks from the first student, and give them to the second student. The final scores are:
, pass
, pass.
, fail.
, pass.
So, students pass. It can be shown that this is the maximum number.
Input 2
3
45 45 45
Output 2
2
Input 3
3
90 10 40
Output 3
2
Comments