#include using namespace std; // n個の中からr個を取り出すときの順列数を取得 template T permutation(T n, T r) { if (!n || !r) return 1; T p{n}; for (T i = n - 1; i > n - r; --i) p *= i; return p; } int main() { int N; cin >> N; vector A(N), B(N); for (int i{}; i < N; ++i) cin >> A[i]; for (int i{}; i < N; ++i) cin >> B[i]; int per = permutation(N, N); sort(B.begin(), B.end()); double ans{}; do { double win{}; for (int i{}; i < N; ++i) { if (A[i] > B[i]) { ++win; } } if (win > N / 2) { ++ans; } } while (next_permutation(B.begin(), B.end())); cout << ans / per << endl; return 0; }