#include<iostream>
using namespace std;
int shuru[105];
int main()
{
int n,jishu=0,j=1;
int i,sum=0;
while(cin>>n && n!=0)
{
for(i=0;i<n;i++)
{
cin>>shuru[i];
sum+=shuru[i];
}
sum/=n;
for(i=0;i<n;i++)
if(shuru[i]>sum)
jishu+=shuru[i]-sum;
cout<<"Set #"<<j<<endl
<<"The minimum number of moves is "
<<jishu<<"."<<endl<<endl;
j++;
jishu=0;
sum=0;
}
return 0;
}