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