#include <bits/stdc++.h>
using namespace std;
int a[200200];
double p[2 * 200200];
double p2[2 * 200200];
double acc[2 * 200200];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) scanf("%d", a + i);
  sort(a, a + n);
  int ev = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (a[j] > a[i]) ev++;
  for (int i = 0; i < n; i++)
    for (int j = 0; j < n; j++)
      if (a[j] > a[i]) p[a[j] - a[i]] += 1.0 / ev;
  for (int i = 0; i <= 5000; i++)
    for (int j = 0; j <= 5000; j++) p2[i + j] += p[i] * p[j];
  acc[0] = p2[0];
  for (int i = 1; i <= 10000; i++) acc[i] = acc[i - 1] + p2[i];
  double ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++)
      if (a[j] > a[i]) ans += (1.0 / ev) * acc[a[j] - a[i] - 1];
  printf("%.10lf\n", ans);
}
