#include <bits/stdc++.h>
using namespace std;
const int size = 5007;
long long a[size], diff[size];
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cout << fixed << setprecision(10);
  int n;
  cin >> n;
  for (int i = 0; i < n; ++i) cin >> a[i];
  long long s = 0;
  for (int i = 0; i < n; ++i)
    for (int j = 0; j < i; ++j) diff[abs(a[i] - a[j])]++, s++;
  long double ans = 0;
  long long sum[size];
  sum[0] = diff[0];
  for (int i = 1; i < size; ++i) sum[i] = sum[i - 1] + diff[i];
  for (int i = 0; i < size; ++i)
    if (diff[i] > 0)
      for (int j = 0; j < size; ++j)
        if (diff[j] > 0)
          ans +=
              diff[i] * diff[j] * (sum[size - 1] - sum[min(size - 1, i + j)]);
  ans /= (1.0 * s);
  ans /= (1.0 * s);
  ans /= (1.0 * s);
  cout << ans;
  return 0;
}
