#include <bits/stdc++.h>
using namespace std;
inline long long in() {
  int32_t x;
  scanf("%d", &x);
  return x;
}
inline string getStr() {
  char ch[1001];
  scanf("%s", ch);
  return ch;
}
inline char getCh() {
  char ch;
  scanf(" %c", &ch);
  return ch;
}
template <class P, class Q>
inline P smin(P &a, Q b) {
  if (b < a) a = b;
  return a;
}
template <class P, class Q>
inline P smax(P &a, Q b) {
  if (a < b) a = b;
  return a;
}
const long long MOD = 1e9 + 7;
const long long MAX_N = 1e6 + 10;
const long long MAX_LG = 21;
const long long base = 29;
const long long MAX_DIF = 5005;
long long a[MAX_N];
long long dif[MAX_DIF];
long long dp[MAX_DIF];
long double res;
int32_t main() {
  long long n = in();
  for (long long i = 0; i < n; i++) a[i] = in();
  sort(a, a + n);
  for (long long i = 1; i < n; i++)
    for (long long j = i - 1; j >= 0; j--) dif[a[i] - a[j]]++;
  for (long long i = 1; i < MAX_DIF; i++) {
    dp[i] += dp[i - 1];
    for (long long x = 0; x < i; x++) {
      dp[i] += 1LL * dif[x] * dif[i - x];
    }
  }
  for (long long i = 0; i < n; i++) {
    for (long long j = 0; j < i; j++) {
      res += dp[a[i] - a[j] - 1];
    }
  }
  cout << res << endl;
  for (long long i = 1; i <= 3; i++) res /= 1LL * n * (n - 1) / 2;
  cout.precision(20);
  cout << fixed << res << endl;
}
