#include <bits/stdc++.h>
long long a, b, s, g, r, i, p, q, h, j, k, sumf[5555], x[2222], y[5555];
double ans;
int main() {
  scanf("%I64d", &a);
  for (i = 1; i <= a; i++) scanf("%I64d", &x[i]);
  for (i = 1; i <= a; i++) {
    for (j = i + 1; j <= a; j++) {
      h = x[i] - x[j];
      if (h < 0) h = -h;
      y[h]++;
      s++;
    }
  }
  for (i = 1; i <= 5000; i++) sumf[i] = sumf[i - 1] + y[i];
  for (i = 1; i <= 5000; i++)
    if (y[i]) {
      double hh = 0;
      for (j = 1; j <= i; j++) {
        hh += (double)y[j] / (double)s * (double)sumf[i - j - 1] / (double)s;
      }
      hh *= (double)y[i];
      hh /= (double)s;
      ans += hh;
    }
  printf("%.10lf", ans);
}
