Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

The problem statement has recently been changed. View the changes.

×
F. Random Query

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputYou 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* ≤ 10^{6}). The second line contains *n* integer numbers *a*_{1}, *a*_{2}, ... *a*_{n} (1 ≤ *a*_{i} ≤ 10^{6}) — 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 , 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

Codeforces (c) Copyright 2010-2021 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Jan/24/2021 04:45:10 (h1).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|