content: package v101;
  import java.io.BufferedReader;
  import java.io.IOException;
  import java.io.InputStream;
  import java.io.InputStreamReader;
  import java.io.PrintWriter;
  import java.util.StringTokenizer;
   
   
  public class TheTrip_UVa10137 {
  	
  	public static void main(String[] args) throws IOException {
  		Scanner sc = new Scanner(System.in);
  		PrintWriter out = new PrintWriter(System.out);
  		
  		while(true)
  		{
  			int N = sc.nextInt();
  			if(N == 0)
  				break;
  			int tot = 0, a[] = new int[N];
  			for(int i = 0; i < N; ++i)
  				tot += a[i] = (int) Math.round(sc.nextDouble() * 100);
  			int ans = 0, remCents = tot % N;
  			tot /= N;
  			for(int x : a)
  				if(x > tot)
  				{
  					if(remCents-->0)
  						x--;
  					ans += x - tot;
  				};
  			out.printf("$%.2f\n", ans / 100.0);
  		}
  		out.flush();
  		out.close();
  	}
  	
  	static class Scanner 
  	{
  		StringTokenizer st;
  		BufferedReader br;
   
  		public Scanner(InputStream s){	br = new BufferedReader(new InputStreamReader(s));}
  	 
  		public String next() throws IOException 
  		{
  			while (st == null || !st.hasMoreTokens()) 
  				st = new StringTokenizer(br.readLine());
  			return st.nextToken();
  		}
   
  		public int nextInt() throws IOException {return Integer.parseInt(next());}
   
  		public long nextLong() throws IOException {return Long.parseLong(next());}
   
  		public String nextLine() throws IOException {return br.readLine();}
   
  		public double nextDouble() throws IOException { return Double.parseDouble(next()); }
   
  		public boolean ready() throws IOException {return br.ready();} 
  	}
  } 