https://www.luogu.org/problem/P1031
#include <iostream>
using namespace std;
int n;
int inputList[100];
int main()
{
int sum = 0;
cin >> n;
for(int i = 0; i < n; i++)
{
cin>>inputList[i];
sum += inputList[i];
}
int average = sum/n;
for(int i = 0; i < n; i++)
{
inputList[i] -= average;
}
int iRet = 0;
for(int i = 0; i < n; i++)
{
if (inputList[i] != 0)
{
inputList[i+1] += inputList[i];
inputList[i] = 0;
iRet++;
}
}
cout << iRet << endl;
return 0;
}