#include <stdio.h>
int main ()
{
int n , h [120] ,sum ,i ,p ,x ,j ,s,cnt=0 ;
while (scanf ("%d",&n)== 1 && n!=0)
{
sum =0 ; cnt++ ;
for (i=1 ; i<=n ;i++)
{
scanf ("%d",&h[i]) ;
sum = sum + h [i] ;
}
p = sum /n ;
s =0 ;
for (j =1 ; j<= n ; j++)
{
if (p < h [j] )
{
x = h [j] - p ;
s= s+x ;
}
}
printf ("Set #%d",cnt) ;
printf ("\nThe minimum number of moves is %d.\n\n",s) ;
}
return 0 ;
}
int main ()
{
int n , h [120] ,sum ,i ,p ,x ,j ,s,cnt=0 ;
while (scanf ("%d",&n)== 1 && n!=0)
{
sum =0 ; cnt++ ;
for (i=1 ; i<=n ;i++)
{
scanf ("%d",&h[i]) ;
sum = sum + h [i] ;
}
p = sum /n ;
s =0 ;
for (j =1 ; j<= n ; j++)
{
if (p < h [j] )
{
x = h [j] - p ;
s= s+x ;
}
}
printf ("Set #%d",cnt) ;
printf ("\nThe minimum number of moves is %d.\n\n",s) ;
}
return 0 ;
}