#include <bits/stdc++.h>
using namespace std;
inline int in() {
  int x;
  scanf("%d", &x);
  return x;
}
const int N = 2e3 + 92;
const int K = 5e3 + 92;
const int MOD = 1e9 + 7;
const long double eps = 1e-12;
long long n, a[N], cnt[K], DP[K];
vector<int> vec;
long double ans, num;
int main() {
  n = in();
  for (int i = 0; i < n; i++) a[i] = in();
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j < n; j++) {
      num++;
      int dif = max(a[i], a[j]) - min(a[i], a[j]);
      vec.push_back(dif);
      cnt[dif]++;
    }
  for (int i = 0; i < K; i++)
    for (int j = 0; j < K; j++) {
      if (i + j >= K) continue;
      if (i != j)
        DP[i + j] += cnt[i] * cnt[j];
      else
        DP[i + j] += ((cnt[i] * (cnt[i] - 1)) / 2);
    }
  for (int i = 1; i < K; i++) DP[i] += DP[i - 1];
  for (int i = 0; i < vec.size(); i++) {
    int dif = vec[i];
    ans += DP[dif];
  }
  ans /= (num * num * num);
  cout.precision(10);
  cout << fixed << ans;
  return 0;
}
