Thinking
Really speaking, this question and contest a bit like building blocks, I started even confused, but the code did not do much worse, broadly consistent with the general idea.
Innocent greedy, as long as a number before a number is not as mean, put the number in the original basis with a number of former difference between the average and let the answer increment, the final output can answer ~~ ~
Code
#include<iostream>
#include<cstdio>
#include<string>
#include<vector>
#include<algorithm>
#include<cstdlib>
#include<cmath>
#include<stack>
#include<map>
using namespace std;
int n,i,x,a[101],ans;
int main()
{
cin>>n;
for(i=1;i<=n;i++)
cin>>a[i];
//a[0]=a[n];
for(i=1;i<=n;i++)
x+=a[i];
x/=n;
for(i=0;i<=n;i++)
a[i]-=x;
for(i=2;i<=n;i++)
{
if(a[i-1]!=0)
a[i]+=a[i-1],ans++;
}
cout<<ans;
return 0;
}