#include #include #include using namespace std; int main() { int N; cin >> N; vector 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.begin(), A.end()); sort(B.begin(), B.end()); int a = 0; do { do { int aa = 0, bb = 0; for (int i = 0; i < N; ++i) { if (A[i] > B[i]) ++aa; if (A[i] < B[i]) ++bb; } if (aa > bb) ++a; } while (next_permutation(B.begin(), B.end())); sort(B.begin(), B.end()); } while (next_permutation(A.begin(), A.end())); int u = 1; for (int i = 1; i <= N; ++i) u *= i; u *= u; cout << a * 1.0 / u << endl; }