P7584 [COCI 2012/2013 #1] F7

Description

There are $N$ players participating in a contest. In each round, the player in 1st place gets $N$ points, the player in 2nd place gets $N - 1$ points, and so on, with the last player getting $1$ point. Now the $i$-th player initially has $B_i$ points. Determine how many players, after one round, have a chance for their score to become the highest among all players.

Input Format

The input has $N + 1$ lines. The first line contains a positive integer $N$, the total number of players. The next $N$ lines each contain an integer $B_i$, the initial score of the $i$-th player.

Output Format

Output one line with an integer, the number of players whose score has a chance to become the highest among all players.

Explanation/Hint

#### Constraints For $100\%$ of the testdata, $3 \le N \le 3 \times 10^5$, $1 \le B_i \le 2 \cdot 10^6$. #### Notes The score setting of this problem follows the original COCI problem, with a full score of $80$. Translated from **[COCI2012-2013](https://hsin.hr/coci/archive/2012_2013) [CONTEST #1](https://hsin.hr/coci/archive/2012_2013/contest1_tasks.pdf) _T2 F7_**. Translated by ChatGPT 5