#include #include #include #include #include #include #include #include #include #define ll long long int #define pb push_back #define mk make_pair #define pq priority_queue using namespace std; typedef pair P; typedef pair Pl; const int inf = 1e9; const ll linf = 1LL << 50; int n; vector a; vector b; int main(int argc, char const* argv[]) { cin >> n; for(int i = 0; i < n; i++){ int aa; cin >> aa; a.pb(aa); } for(int i = 0; i < n; i++){ int bb; cin >> bb; b.pb(bb); } int all = 0; int win = 0; vector ac; for(int i = 0; i < n; i++)ac.pb(i); do{ vector bc; for(int i = 0; i < n; i++)bc.pb(i); do{ int res = 0; for(int i = 0; i < n; i++){ if(a[ac[i]] > b[bc[i]])res++; } all++; if(res > n - res)win++; }while(next_permutation(bc.begin(), bc.end())); }while(next_permutation(ac.begin(), ac.end())); cout << (double)win / (double)all << endl; return 0; }