#include <bits/stdc++.h>
using namespace std;
const int MAXN = 2010;
const int MVAL = 5010;
int n;
long long arr[MVAL];
long long diff[MVAL];
long long pdiff[MVAL];
int main(void) {
  cin >> n;
  memset(arr, 0, sizeof(arr));
  for (int i = 0; i < n; i++) {
    int a;
    cin >> a;
    arr[a]++;
  }
  memset(diff, 0, sizeof(diff));
  long long tot = n * (n - 1) / 2;
  for (int i = 1; i < MVAL; i++) {
    for (int j = i + 1; j < MVAL; j++) {
      diff[abs(i - j)] += arr[j] * arr[i];
    }
  }
  pdiff[0] = 0;
  for (int i = 1; i < MVAL; i++) {
    pdiff[i] = pdiff[i - 1] + diff[i];
  }
  double ans = 0;
  for (int i = 1; i < MVAL; i++) {
    for (int j = 1; j < i; j++) {
      ans += diff[i] * diff[j] * pdiff[i - j - 1];
    }
  }
  ans /= (tot * tot * tot);
  printf("%.12f\n", ans);
  return 0;
}
