import java.io.*;
import java.util.*;
import java.math.*;
import java.util.concurrent.*;

public final class jp
{
    static BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
	static FastScanner sc=new FastScanner(br);
    static PrintWriter out=new PrintWriter(System.out);
	static Random rnd=new Random();
	static int maxn=(int)(5003);
	
    public static void main(String args[]) throws Exception
    {
		int n=sc.nextInt();int[] a=new int[n];
		
		for(int i=0;i<n;i++)
		{
			a[i]=sc.nextInt();
		}
		
		double[] arr=new double[maxn];
		
		for(int i=0;i<n;i++)
		{
			for(int j=i-1;j>=0;j--)
			{
				int diff=Math.abs(a[i]-a[j]);
				
				arr[diff]++;
			}
		}
		
		double[] cnt=new double[maxn];
		
		double den=(n*(n-1))/2.0;
		
		for(int i=1;i<maxn;i++)
		{
			for(int j=i;j>=1;j--)
			{
				cnt[i]=cnt[i]+(arr[j]*arr[i-j]);
			}
		}
		
		for(int i=1;i<maxn;i++)
		{
			cnt[i]=cnt[i]/(den*den);
		}
		
		double[] pre=new double[maxn];double curr=0;
		
		for(int i=maxn-1;i>=0;i--)
		{
			curr=curr+arr[i];
			
			pre[i]=(curr/den);
		}
		
		double res=0;
		
		for(int i=1;i<=5000;i++)
		{
			double now=cnt[i]*pre[i+1];
			
			//out.println(i+" "+cnt[i]);
			
			res=res+now;
		}
		
		out.printf("%.10f\n",res);out.close();
    }
}
class FastScanner
{
    BufferedReader in;
    StringTokenizer st;

    public FastScanner(BufferedReader in) {
        this.in = in;
    }
	
    public String nextToken() throws Exception {
        while (st == null || !st.hasMoreTokens()) {
            st = new StringTokenizer(in.readLine());
        }
        return st.nextToken();
    }
	
	public String next() throws Exception {
		return nextToken().toString();
	}
	
    public int nextInt() throws Exception {
        return Integer.parseInt(nextToken());
    }

    public long nextLong() throws Exception {
        return Long.parseLong(nextToken());
    }

    public double nextDouble() throws Exception {
        return Double.parseDouble(nextToken());
    }
}