#include <bits/stdc++.h>
using namespace std;
const int N = 2005;
int a[N];
double dp[5][10005], f[10005];
int main() {
  int n, mx = -1e9, mi = 1e9;
  scanf("%d", &n);
  double tmp = 1.0 / (1ll * n * (n - 1) / 2);
  for (int i = 1; i <= n; i++)
    scanf("%d", &a[i]), mx = max(mx, a[i]), mi = min(mi, a[i]);
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (a[i] > a[j]) dp[1][a[i] - a[j]] += tmp, dp[2][a[i] - a[j]] += tmp;
  for (int i = 1; i <= mx - mi; i++)
    for (int j = 1; j <= mx - mi; j++) dp[3][i + j] += dp[1][i] * dp[2][j];
  for (int i = 1; i <= 2 * (mx - mi); i++) f[i] = f[i - 1] + dp[3][i];
  double ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      if (a[j] > a[i]) ans += f[a[j] - a[i] - 1] * tmp;
  printf("%.10lf", ans);
  return 0;
}
