#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std; double solve(const vector& a, const vector& b, bitset<4> bs, int diff) { int n = a.size(); int j = bs.count(); if(j == n){ if(diff > 0) return 1.0; else return 0.0; } double ret = 0.0; for(int i=0; i b[j]) ret += solve(a, b, bs, diff + 1); else if(a[i] < b[j]) ret += solve(a, b, bs, diff - 1); else ret += solve(a, b, bs, diff); bs[i] = false; } } ret /= n - j; return ret; } int main() { int n; cin >> n; vector a(n), b(n); for(int i=0; i> a[i]; for(int i=0; i> b[i]; printf("%.10f\n", solve(a, b, 0, 0)); return 0; }