#include #define rep(i,n) for(int i=0;i<(n);++i) #define pb push_back; using namespace std; typedef long long ll; int main(){ int N; cin >> N; int A[N], B[N]; for (int i = 0; i < N; i++) { cin >> A[i]; } for (int i = 0; i < N; i++) { cin >> B[i]; } sort(A, A + N); sort(B, B + N); int res = 0; int count = 0; do { int cpB[N]; copy(B, B + N, cpB); do { int win = 0; for (int i = 0; i < N; i++) { if (A[i] > cpB[i]) win++; } if (win > N / 2) res++; count++; } while (next_permutation(cpB, cpB + N)); } while(next_permutation(A, A + N)); cout << (double) res / count << endl; return 0; }