/*****************************************************************
** NumberStats2 - same a NumberStats except using vectors
**
** The data are first read into a dynamic array (a Vector object)
** and then a double array is declared with precisely the size
** needed.  The elements of the Vector object are then copied
** into the double array, and statistics are generated as before.
** Note, however, that the statistics methods are reworked
** slighlty.  Is is no longer necessary to maintain a 'size'
** variable and pass it to the statistics methods.  Over all,
** this is a much better approach.
**
** (c) Scott MacKenzie, 2000                             
******************************************************************/
import java.io.*;
import java.util.*;

public class NumberStats2
{
   public static void main(String[] args) throws IOException
   {
      BufferedReader stdin =
         new BufferedReader(new InputStreamReader(System.in), 1);

      // declare 'v' as a dynamic array (a Vector object)
      Vector v = new Vector();

      // input data and put into dynamic array
      String line;
      while ((line = stdin.readLine()) != null)
      {
         // prepare to tokenize line
         StringTokenizer st = new StringTokenizer(line, " ,\t");

         // process tokens in line
         while (st.hasMoreTokens())
         {
            String s = st.nextToken();  // get a token
            Double d = new Double(s);   // convert and wrap as Double
            v.addElement(d);            // add to dynamic array
         }
      }

      // declare a double array with exactly the size needed
      double[] numbers = new double[v.size()];

      // copy and convert elements of Vector object into double array
      for (int i = 0; i < v.size(); i++)
         numbers[i] = ((Double)v.elementAt(i)).doubleValue();

      // output some statistics on the data
      System.out.println("N = " + numbers.length);
      System.out.println("Minimum = " + min(numbers));
      System.out.println("Maximum = " + max(numbers));
      System.out.println("Mean = " + mean(numbers));
      System.out.println("Standard deviation = " + sd(numbers));
   }

   // find the minimum value in an array
   public static double min(double[] n)
   {
      double min = n[0];
      for (int j = 1; j < n.length; j++)
         if (n[j] < min)
            min = n[j];
      return min;
   }

   // find the maximum value in a array
   public static double max(double[] n)
   {
      double max = n[0];
      for (int j = 1; j < n.length; j++)
         if (n[j] > max)
            max = n[j];
      return max;
   }

   // calculate the mean of the values in an array
   public static double mean(double n[])
   {
      double mean = 0.0;
      for (int j = 0; j < n.length; j++)
         mean += n[j];   
      return mean / n.length;
   }

   // calculate the standard deviation of values in an array
   public static double sd(double[] n)
   {
      double m = mean(n);
      double t = 0.0;
      for (int j = 0; j < n.length; j++)
         t += (m - n[j]) * (m - n[j]);
      return Math.sqrt(t / (n.length - 1.0));
   }
}

