Problem: You are given an array a consisting of n positive integers. You pick two integer numbers l and r from 1 to n, inclusive (numbers are picked randomly, equiprobably and independently). If l > r, then you swap values of l and r. You have to calculate the expected value of the number of unique elements in segment of the array from index l to index r, inclusive (1-indexed).

Input

The first line contains one integer number n (1 ≤ n ≤ 106). The second line contains n integer numbers a1, a2, ... an (1 ≤ ai ≤ 106) — elements of the array.

Output

Print one number — the expected number of unique elements in chosen segment. 

Your answer will be considered correct if its absolute or relative error doesn't exceed 10 - 4 — formally, the answer is correct if <image>, where x is jury's answer, and y is your answer.

Examples

Input

2
1 2


Output

1.500000


Input

2
2 2


Output

1.000000

Solution (in CPP):

Solution:
#include <bits/stdc++.h>
using namespace std;
using uint = unsigned int;
using ll = long long;
using ull = unsigned long long;
using pii = pair<int, int>;
using pli = pair<ll, int>;
using pil = pair<int, ll>;
using pll = pair<ll, ll>;
template <typename T>
using vec = vector<T>;
using vi = vec<int>;
using vl = vec<ll>;
template <typename T>
using que = queue<T>;
template <typename T>
using deq = deque<T>;
template <typename T>
T id(T b) {
  return b;
};
template <typename T>
void chmax(T &x, T y) {
  if (x < y) x = y;
}
template <typename T>
void chmin(T &x, T y) {
  if (x > y) x = y;
}
template <typename S, typename K>
bool contains(S &s, K k) {
  return s.find(k) != s.end();
}
void fastio() {
  ios_base::sync_with_stdio(false);
  cin.tie(nullptr);
}
constexpr ll TEN(int n) {
  if (n == 0)
    return 1LL;
  else
    return 10LL * TEN(n - 1);
}
const int MAX_A = TEN(6);
vi idx[MAX_A + 1];
int main() {
  fastio();
  ll n;
  cin >> n;
  set<int> s;
  int x;
  for (int i = 0; i < int(n); i++) {
    cin >> x;
    idx[x].push_back(i);
    s.insert(x);
  }
  ll total = 0;
  for (int i = 1; i <= int(TEN(6)); i++) {
    for (int j = 0; j < int(idx[i].size()) - 1; j++) {
      ll d = idx[i][j + 1] - idx[i][j] - 1;
      total += d * d;
    }
    if (!idx[i].empty()) {
      ll d1 = idx[i].front();
      ll d2 = n - 1 - idx[i].back();
      total += d1 * d1 + d2 * d2;
    }
  }
  long double y = total;
  long double n2 = 1.0L * n * n;
  cout << fixed << setprecision(15) << ((n2 * s.size() - y) / n2) << endl;
  return 0;
}