#include using namespace std; using ll = long long; using ull = unsigned long long; using ld = long double; using pii = pair; using pdd = pair; using pll = pair; using pli = pair; using pil = pair; template using Graph = vector>; const int MOD = 1e9 + 7; const ld PI = acos(-1); int main() { cin.tie(0); ios::sync_with_stdio(false); 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]; } vector v(2 * N); iota(v.begin(), v.begin() + N, 0); iota(v.begin() + N, v.end(), 0); int ans = 0; do { do { int cnt = 0; for (int i = 0; i < N; ++i) { cnt += (A[v[i]] > B[v[i + N]] ? 1 : -1); } if (cnt > 0) ans++; } while (next_permutation(v.begin() + N, v.end())); } while (next_permutation(v.begin(), v.begin() + N)); int fac = 1; for (int i = 1; i <= N; ++i) { fac *= i * i; } cout << fixed << setprecision(10) << (ld)ans / fac << endl; return 0; }