Codeforces Round 151 (Div. 2)
B
Increase and Decrease
Codeforces
1300
原题
← AC →
翻译中…

Polycarpus has an array, consisting of $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$. Polycarpus likes it when numbers in an array match. That's why he wants the array to have as many equal numbers as possible. For that Polycarpus performs the following operation multiple times:

翻译中…
  • he chooses two elements of the array $*a*_{*i*}$, $*a*_{*j*}$ $(*i* ≠ *j*)$;
  • he simultaneously increases number $*a*_{*i*}$ by $1$ and decreases number $*a*_{*j*}$ by $1$, that is, executes $*a*_{*i*} = *a*_{*i*} + 1$ and $*a*_{*j*} = *a*_{*j*} - 1$.
翻译中…

The given operation changes exactly two distinct array elements. Polycarpus can apply the described operation an infinite number of times.

翻译中…

Now he wants to know what maximum number of equal array elements he can get if he performs an arbitrary number of such operation. Help Polycarpus.

翻译中…

Input

翻译中…

The first line contains integer $*n*$ ($1 ≤ *n* ≤ 10^{5}$) — the array size. The second line contains space-separated integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$ ($|*a*_{*i*}| ≤ 10^{4}$) — the original array.

翻译中…

Output

翻译中…

Print a single integer — the maximum number of equal array elements he can get if he performs an arbitrary number of the given operation.

翻译中…

样例

Input #1
2
2 1
Output #1
1
InputCopy OutputCopy
Input #2
3
1 4 1
Output #2
3
InputCopy OutputCopy
题目信息
题号
246B
时间限制
2 s
内存限制
256 MB
标签
贪心
数学

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。