#1076
Unrated
F7
시간 제한
1s
메모리 제한
32MB
제출
0
정답
0
맞힌 사람
0
정답 비율
0.0%

문제

Author: Nikola Dmitrović

The fictional World Championship of Formula 7 Drivers 2012 was characterized by exciting races and frequent shifts of driver positions on the leaderboard. Antun has missed most of it because he was training for olympiads in informatics. Now his only consolation are his medals and being the main character in this task. He has a simple question for you COCI contestants: „How many drivers participating in this Championship still had a chance to become Formula 7 World Champion at the start of the final race?” The World Champion is, of course, the driver with the largest point total at the end (after the final race). There are N drivers participating in the Championship. They are all assigned points after each race, including the final one. The winner of the race is awarded N points, the runner-up gets N - 1 points, and so on until the last driver, who gets 1 point. Two drivers cannot finish a race in the same spot. Write a program to calculate, based on the total number of points that each driver has earned before the final race, how many drivers still have a chance to have the largest total after the final race and thus win the Championship. If more than one driver has the same maximum point total, they are all awarded the World Champion title.

입력

The first line of input contains the positive integer N (3 ≤ N ≤ 300 000), the number of drivers participating in the Championship. Each of the following N lines contains a single integer Bi (0 ≤ Bi ≤ 2 000 000, i = 1, ..., N), the number of points that a driver has before the final race.

출력

The first and only line of output should contain the requested number of drivers that can still win.

예제 입력 1

3
8
10
9

예제 출력 1

3

예제 입력 2

5
15
14
15
12
14

예제 출력 2

4
코드 제출

코드를 제출하려면 로그인이 필요합니다.

로그인
내 제출
제출 내역이 없습니다.
맞은 사람
아직 맞은 사람이 없습니다.
난이도 투표
Unrated0명 투표
로그인 후 AC 받으면 투표할 수 있습니다.
전체 제출
제출 내역이 없습니다.