#include using namespace std; int n; int a[5], b[5]; int p, q; double ans; int main(){ // cin.tie(0); // ios::sync_with_stdio(false); cin >> n; for(int i=0; i> a[i]; for(int i=0; i> b[i]; sort(a, a+n); sort(b, b+n); do{ do{ ++q; int tmp[3] = {}; for(int i=0; i b[i]) ++tmp[0]; else if(a[i] < b[i]) ++tmp[2]; else ++tmp[1]; } if(tmp[0] > tmp[2]) ++p; }while(next_permutation(b, b+n)); }while(next_permutation(a, a+n)); ans = (double)p / q; printf("%.5lf\n", ans); }