#include<bits/stdc++.h>
#define MAX 50
using namespace std;
int main(){
int n,i,j=1,sum,av,move,h[MAX];
while(cin>>n,n!=0){
sum=0;
for(i=0;i<n;i++) {cin>>h[i]; sum+=h[i];}
av=sum/n;
move=0;
for(i=0;i<n;i++) if(h[i]>av) move+=(h[i]-av);
cout<<"Set #"<<j++<<endl;
cout<<"The minimum number of moves is "<<move<<"."<<endl;
}
return 0;
}