CF246B.Increase and Decrease

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Polycarpus has an array, consisting of nn integers a1,a2,...,ana_{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 aia_{i} , aja_{j} (ij)(i≠j) ;
  • he simultaneously increases number aia_{i} by 11 and decreases number aja_{j} by 11 , that is, executes ai=ai+1a_{i}=a_{i}+1 and aj=aj1a_{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.

输入格式

The first line contains integer nn ( 1<=n<=1051<=n<=10^{5} ) — the array size. The second line contains space-separated integers a1,a2,...,ana_{1},a_{2},...,a_{n} ( ai<=104|a_{i}|<=10^{4} ) — the original array.

输出格式

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

输入输出样例

  • 输入#1

    2
    2 1
    

    输出#1

    1
    
  • 输入#2

    3
    1 4 1
    

    输出#2

    3
    
首页