// Arup Guha
// 4/12/2023
// Solution to 2017 MAPS Problem C: Figurine Figures

import java.io.*;
import java.util.*;

public class figurinefigures {

	public static int n;
	public static int len;
	public static int[] order;
	public static double[] cos;
	public static double[] sin;

	public static void main(String[] args) throws Exception {

		BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));

		// Read in data as polynomial, each figurine adds 1 to the corresponding coefficient.
		n = Integer.parseInt(stdin.readLine());
		len = (1<<18);
		long[] poly = new long[len];
		StringTokenizer tok = new StringTokenizer(stdin.readLine());
		for (int i=0; i<n; i++) {
			int val = Integer.parseInt(tok.nextToken());
			poly[val]++;
		}

		// Building order array for FFT.
		order = new int[2];
		order[1] = 1;

		// Just iterate building next array from previous.
		while (order.length != len) {
			int[] tmp = new int[order.length<<1];
			for (int i=0; i<order.length; i++) {
				tmp[2*i] = order[i];
				tmp[2*i+1] = order[i] + order.length;
			}
			order = tmp;
		}

		// Pre-calculate.
		cos = new double[len];
		for (int i=0; i<len; i++) cos[i] = Math.cos(i*2*Math.PI/len);
		sin = new double[len];
		for (int i=0; i<len; i++) sin[i] = Math.sin(i*2*Math.PI/len);

		// Just multiply so that we get the polynomial to the 4th power.
		long[] sqr = multiply(poly, poly);
		long[] fourth = multiply(sqr, sqr);
		
		// Stats to keep.
		int min = 1000000;		
		int max = 0;
		int diff = 0;
		double sum = 0;
		double num = 0;
		
		// Go through the polynomial once and update all of our info.
		for (int i=0; i<len; i++) {
			if (fourth[i] != 0) {
				min = Math.min(min, i);
				max = Math.max(max, i);
				diff++;
				num += fourth[i];
				sum += (i*fourth[i]);
			}
		}
		
		// Output the desired results.
		System.out.println(max+" "+min+" "+diff+" "+(sum/num));
	}

	/*** My Hackpack FFT Code is below. ***/
	
	public static void fft(double[] real, double[] img, boolean invert) {

		// Re-order numbers to be in fft ordering for combination.
		double[] tmp = new double[len];
		for (int i=0; i<len; i++)
			tmp[i] = real[order[i]];
		for (int i=0; i<len; i++)
			real[i] = tmp[i];

		tmp = new double[len];
		for (int i=0; i<len; i++)
			tmp[i] = img[order[i]];
		for (int i=0; i<len; i++)
			img[i] = tmp[i];

		// size is the size of each grouping (when we combine up) in fft.
		for (int size=2; size<=len; size<<=1) {

			// Set up angle and halfway pt.
			int half = (size>>1);
			int skip = len/size;
			int sign = !invert ? 1 : -1;

			// i is the starting index for this group, j indicates pairs.
			for (int i=0; i<len; i+=size) {
				double aReal = 1, aImg = 0;
				int index = 0;
				for (int j=0; j<half; j++) {
					double fReal = real[i+j], fImg = img[i+j];
					double sReal = real[i+j+half]*cos[index] - img[i+j+half]*sin[index];
					double sImg = img[i+j+half]*cos[index] + real[i+j+half]*sin[index];
					real[i+j] = fReal + sReal;
					img[i+j] = fImg + sImg;
					real[i+j+half] = fReal - sReal;
					img[i+j+half] = fImg - sImg;
					index = (index+sign*skip+len)%len;
				}
			}
		}

		// For inverse transformation, we divide by n (my len).
		if (invert) {
			for (int i=0; i<len; i++) {
				real[i] /= len;
				img[i] /= len;
			}
		}
	}

	public static long[] multiply(long[] a, long[] b) {

		// Copy a.
		double[] reala = new double[len];
		for (int i=0; i<len; i++) reala[i] = a[i];
		double[] imga = new double[len];

		// Copy b.
		double[] realb = new double[len];
		for (int i=0; i<len; i++) realb[i] = b[i];
		double[] imgb = new double[len];

		// Transform into points.
		fft(reala, imga, false);
		fft(realb, imgb, false);

		// Store product pts here.
		double[] realPts = new double[len];
		double[] imgPts = new double[len];

		// Multiply points.
		for (int i=0; i<len; i++) {
			realPts[i] = reala[i]*realb[i] - imga[i]*imgb[i];
			imgPts[i] = reala[i]*imgb[i] + realb[i]*imga[i];
		}

		// Now, convert these points back to a polynomial.
		fft(realPts, imgPts, true);

		// Finally copy over into a result array without doubles.
		long[] res = new long[len];
		for (int i=0; i<len; i++)
			res[i] = Math.round(realPts[i]);
		return res;
	}
}