Cinderella is given a task by her Stepmother before she is allowed to go to the Ball. There are N (1 ≤ N ≤ 1000) bottles with water in the kitchen. Each bottle contains Li (0 ≤ Li ≤ 106) ounces of water and the maximum capacity of each is 109 ounces. To complete the task Cinderella has to pour the water between the bottles to fill them at equal measure.
Cinderella asks Fairy godmother to help her. At each turn Cinderella points out one of the bottles. This is the source bottle. Then she selects any number of other bottles and for each bottle specifies the amount of water to be poured from the source bottle to it. Then Fairy godmother performs the transfusion instantly.
Please calculate how many turns Cinderella needs to complete the Stepmother's task.
The first line of input contains an integer number N (1 ≤ N ≤ 1000) — the total number of bottles.
On the next line integer numbers Li are contained (0 ≤ Li ≤ 106) — the initial amount of water contained in ith bottle.
Output a single line with an integer S — the minimal number of turns Cinderella needs to complete her task.
## Input
The first line of input contains an integer number N (1 ≤ N ≤ 1000) — the total number of bottles.On the next line integer numbers Li are contained (0 ≤ Li ≤ 106) — the initial amount of water contained in ith bottle.
## Output
Output a single line with an integer S — the minimal number of turns Cinderella needs to complete her task.
[samples]
**Definitions**
Let $ N \in \mathbb{Z}^+ $ be the number of bottles.
Let $ L = (L_1, L_2, \dots, L_N) $ be the initial water amounts in the bottles, where $ L_i \in \mathbb{R}_{\geq 0} $.
Let $ T = \frac{1}{N} \sum_{i=1}^N L_i $ be the target amount of water per bottle (equal distribution).
**Constraints**
1. $ 1 \leq N \leq 1000 $
2. $ 0 \leq L_i \leq 10^6 $ for all $ i \in \{1, \dots, N\} $
3. $ T \leq 10^9 $ (feasible due to capacity constraint)
**Objective**
Find the minimal number of turns $ S $, where each turn consists of selecting one source bottle and distributing its water to any number of other bottles (any amount per recipient), such that after $ S $ turns, all bottles contain exactly $ T $ ounces.
**Note**: A bottle can be a source only if it has more than $ T $; a bottle with less than $ T $ must receive water. Bottles with exactly $ T $ require no action.
Each turn can empty a source bottle completely (or partially) into multiple targets.
The minimal number of turns equals the number of bottles that are **not** already at $ T $, **minus** the number of times a single source can supply multiple deficits in one turn.
**Key Insight**:
Each turn can fix **one source** (overfilled bottle) and **multiple targets** (underfilled bottles).
Thus, the minimal number of turns is the number of **overfilled bottles** (those with $ L_i > T $), since each such bottle must be used as a source exactly once, and can supply multiple underfilled bottles in one turn.
**Alternative Insight**:
Since water is conserved and only transfers occur, the minimal number of turns equals the number of bottles that are **not** in equilibrium, **minimized by grouping transfers**.
It is known in such problems that the minimal number of operations is equal to the number of **non-zero net flows**, which reduces to:
$$
S = \text{number of bottles with } L_i \ne T \quad \text{minus the maximum number of bottles that can be balanced in one transfer}
$$
But the optimal strategy:
- Each overfilled bottle must be a source in exactly one turn.
- Underfilled bottles can be filled from one or more sources.
- Bottles at $ T $ are ignored.
Thus, **each overfilled bottle requires one turn**. Underfilled bottles do not require turns — they are receivers.
Hence:
$$
S = \left| \left\{ i \in \{1, \dots, N\} \mid L_i > T \right\} \right|
$$
✅ **Final Answer**:
$$
S = \#\{ i \mid L_i > T \}
$$