from __future__ import division
from sys import stdin


def arr_sum(arr):
    tem = [0]
    for i in range(len(arr)):
        tem.append(tem[i] + arr[i])
    return tem


rints = lambda: [int(x) for x in stdin.readline().split()]
n, a, N = int(input()), rints(), 5001
mem = [0] * N
for i in range(n - 1):
    for j in range(i + 1, n):
        mem[abs(a[i] - a[j])] += 1

cum = [0] * N
for i in range(N - 1):
    for j in range(i + 1, N):
        cum[j - i] += mem[i] * mem[j]

cum, ans, prob = arr_sum(cum), 0, 1 / (n ** 3)

for i in range(n - 1):
    for j in range(i + 1, n):
        diff = abs(a[j] - a[i])
        ans += prob * (cum[-1] - cum[diff + 1])

print(ans)
