#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
const long double PI(acos(-1.0));
using namespace std;
const int N = 10050;
long long sums[N + 1];
long long prs[N * 2 + 1];
long long smtr[N * 2 + 1];
long long allprs = 0;
int main() {
  cout.precision(10);
  int n;
  cin >> n;
  allprs = n * (n - 1) / 2;
  vector<int> a(n);
  for (int i = 0; i < n; ++i) cin >> a[i];
  for (int i = 0; i < n; ++i)
    for (int j = i + 1; j < n; ++j) sums[abs(a[i] - a[j])]++;
  for (int i = 0; i < N; ++i) {
    for (int j = i; j < N; ++j) {
      if (i == j)
        prs[i + i] += sums[i] * (sums[i] + 1);
      else
        prs[i + j] += sums[i] * sums[j];
    }
  }
  for (int i = (N << 1) - 2; i >= 0; --i) smtr[i] = sums[i] + smtr[i + 1];
  long double ans = 0;
  for (int i = 0; i < N * 2 - 1; ++i) {
    long double verchspr = (prs[i] + .0) / (allprs + .0);
    verchspr /= (allprs + .0);
    verchspr *= (smtr[i + 1] + .0);
    verchspr /= (allprs + .0);
    ans += verchspr;
  }
  cout << fixed << ans;
}
