#include <bits/stdc++.h>
using namespace std;
double prob[10001], prob2[10001];
int main() {
  int n, balls[2000];
  while (scanf("%d", &n) == 1) {
    for (int i = 0; i < n; ++i) scanf("%d", &balls[i]);
    memset(prob, 0, sizeof(prob));
    memset(prob2, 0, sizeof(prob2));
    int win = 0, lose = 0;
    for (int a = 0; a < n; ++a)
      for (int j = 0; j < n; ++j)
        if (a != j) {
          if (balls[a] > balls[j])
            ++win;
          else
            ++lose;
        }
    for (int a = 0; a < n; ++a)
      for (int j = 0; j < n; ++j)
        if (a != j) {
          if (balls[a] > balls[j])
            prob[balls[a] - balls[j] + 5000] += 1. / win;
          else
            prob[balls[a] - balls[j] + 5000] += 1. / lose;
        }
    for (int i = 0; i <= 5000; ++i)
      for (int j = 0; j <= 5000; ++j)
        prob2[i + j] += prob[i + 5000] * prob[j + 5000];
    double ans = 0.;
    for (int i = 0; i <= 10000; ++i)
      for (int j = -5000; j < -i; ++j) ans += prob2[i] * prob[j + 5000];
    printf("%.10lf\n", ans);
  }
  return 0;
}
