#include <iostream>
using namespace std;
int main()
{
int n, h[51], set=1;
while (cin >> n)
{
if (n==0)
{
break;
}
int sum=0;
for (int i=0; i<n; i++)
{
cin >> h[i];
sum+=h[i];
}
int avg=sum/n;
int move=0;
for (int i=0; i<n; i++)
{
if (h[i]>avg)
{
move+=h[i]-avg;
}
}
cout <<"Set #"<< set++ <<endl;
cout <<"The minimum number of moves is "<< move <<"."<<endl;
}
}