#include <stdio.h>
#include <string.h>
#define N 55
int a[N];
int main()
{
int n, sum, ans, cas = 1;
while(scanf("%d", &n), n)
{
memset(a, 0, sizeof(a));
sum = ans = 0;
for(int i = 0; i < n; i++)
{
scanf("%d", &a[i]);
sum += a[i];
}
sum /= n;
for(int i = 0; i < n; i++)
{
if(a[i] > sum) ans += a[i] - sum;
}
printf("Set #%d\n", cas++);
printf("The minimum number of moves is %d.\n\n", ans);
}
return 0;
}