#include<iostream>
#include<cstdio>
#include<cmath>
using namespace std;
int main()
{
int i, n, k, t=1, ans, average, sum, a[105], j;
while(scanf("%d", &n)==1)
{
if(n==0)
{
break;
}
sum=0;
for(i=1; i<=n; i++)
{
scanf("%d", &a[i]);
sum= sum+a[i];
}
average=(sum/n);
k=0;
for(i=1; i<=n; i++)
{
if(a[i]>average)
{
ans=a[i]-average;
k=k+ans;
}
}
printf("Set #%d\nThe minimum number of moves is %d.\n\n", t, k);
t++;
}
return 0;
}