#include <bits/stdc++.h>
using namespace std;
int cnt1[4 * 2005];
int cnt2[4 * 2005];
int sum = 0;
double ans;
int a[2005];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d", &a[i]);
  }
  for (int i = 0; i < n; i++) {
    for (int j = i - 1; j >= 0; j--) {
      cnt1[a[i] - a[j]]++;
      sum++;
    }
  }
  for (int i = 0; i <= 5000; i++) {
    for (int j = 0; j <= 5000; j++) {
      cnt2[i + j] += cnt1[i] * cnt1[j];
    }
  }
  for (int i = 0; i <= 5000; i++) {
    for (int j = i - 1; j >= 0; j--) {
      ans += (1.0 * cnt1[i] / sum) * (1.0 * cnt2[j] / (sum * sum));
    }
  }
  printf("%.15f", ans);
  return 0;
}
