#include <bits/stdc++.h>
using namespace std;
const int maxn = 2000;
int win[maxn + 10], fail[maxn + 10];
int num[maxn + 10];
double combination(int m, int n);
int main() {
  int n;
  while (scanf("%d", &n) == 1) {
    for (int i = 1; i <= n; i++) scanf("%d", &num[i]);
    int a, b, J_score, A_score, k = 0;
    for (int i = 1; i <= n; i++)
      for (int j = 1; j <= n; j++) {
        if (num[j] > num[i]) {
          win[k] = num[j];
          fail[k] = num[i];
          k++;
        }
      }
    int ans = 0;
    for (int i = 0; i < k; i++)
      for (int j = 0; j < k - 1; j++) {
        J_score = fail[i] + fail[j] + win[j + 1];
        A_score = win[i] + win[j] + fail[j + 1];
        if (J_score > A_score) {
          ans++;
        }
      }
    for (int i = 0; i < k; i++)
      for (int j = 0; j < k; j++) {
        J_score = fail[i] + fail[i] + win[j];
        A_score = win[i] + win[i] + fail[j];
        if (J_score > A_score) ans++;
        J_score = fail[j] + fail[i] + win[i];
        A_score = win[j] + win[i] + fail[i];
        if (J_score > A_score) ans++;
        J_score = fail[i] + fail[j] + win[i];
        A_score = win[i] + win[j] + fail[i];
        if (J_score > A_score) ans++;
        J_score = fail[j] + fail[j] + win[i];
        A_score = win[j] + win[j] + fail[i];
        if (J_score > A_score) ans++;
        J_score = fail[i] + fail[j] + win[j];
        A_score = win[i] + win[j] + fail[j];
        if (J_score > A_score) ans++;
        J_score = fail[j] + fail[i] + win[j];
        A_score = win[j] + win[i] + fail[j];
        if (J_score > A_score) ans++;
      }
    double all = combination(3, k) * 6 +
                 combination(1, k) * combination(1, k - 1) * 3 +
                 combination(1, k);
    double probability = (double)ans / all;
    printf("%.10f\n", probability);
  }
  return 0;
}
double combination(int m, int n) {
  double sum = 1, temp = 1;
  for (int i = m + 1; i <= n; i++) sum *= i;
  for (int i = 1; i <= n - m; i++) temp *= i;
  return sum / temp;
}
