

import java.util.Arrays;
import java.util.Scanner;

public class P4 {
	
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		int n = in.nextInt();
		int[] a = new int[n];
		for (int i = 0; i < n; i++) a[i] = in.nextInt();
		Arrays.sort(a);
		long[] diffs = new long[5000];
		for (int i = 0; i < n; i++) {
			for (int j = i-1; j >= 0; j--) {
				if (a[i] > a[j]) {
					diffs[a[i]-a[j]]++;
				}
			}
		}
		long[] totalDiffs = new long[10000];
		for (int i = 0; i < diffs.length; i++) {
			for (int j = 0; j < diffs.length; j++) {
				totalDiffs[i+j] += diffs[i] * diffs[j];
			}
		}
		long all = 0;
		for (int i = 0; i < totalDiffs.length; i++) {
			all += totalDiffs[i];
		}
		System.out.println(all);
		for (int i = 1; i < totalDiffs.length; i++) {
			totalDiffs[i] += totalDiffs[i-1];
		}
		double res = 0;
		int count = 0;
		for (int i = 0; i < n; i++) {
			for (int j = i-1; j >= 0; j--) {
				if (a[i] > a[j]) {
					int diff = a[i]-a[j];
					res += 1d*totalDiffs[diff-1]/all;
					count ++;
				}
			}
		}
		res /= count;
		System.out.println(res);
	}

}
