// clang-format off #include using namespace std; #define int long long #define loop(i, a, n) for (int i = (a); i < (n); i++) #define rep(i, n) loop(i, 0, n) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define prec(n) fixed << setprecision(n) constexpr int INF = sizeof(int) == sizeof(long long) ? 1000000000000000000LL : 1000000000; constexpr int MOD = 1000000007; constexpr double PI = 3.14159265358979; template bool cmin(A &a, const B &b) { return a > b ? (a = b, true) : false; } template bool cmax(A &a, const B &b) { return a < b ? (a = b, true) : false; } bool odd(const int &n) { return n & 1; } bool even(const int &n) { return ~n & 1; } template int len(const T &v) { return v.size(); } template T in() { T x; cin >> x; return x; } template T in(T &&x) { T z(forward(x)); cin >> z; return z; } template istream &operator>>(istream &is, vector &v) { for (T &x : v) is >> x; return is; } template istream &operator>>(istream &is, pair &p) { return is >> p.first >> p.second; } template ostream &operator<<(ostream &os, const vector> &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : "\n"); return os; } template ostream &operator<<(ostream &os, const vector &v) { int n = v.size(); rep(i, n) os << v[i] << (i == n - 1 ? "" : " "); return os; } template ostream &operator<<(ostream &os, const pair &p) { return os << p.first << ' ' << p.second; } template auto vectors(const Head &head, const Value &v) { return vector(head, v); } template auto vectors(Head x, Tail... tail) { auto inner = vectors(tail...); return vector(x, inner); } // clang-format on main() { int n = in(); vector a(n), b(n); cin >> a >> b; sort(all(a)); int c = 0, s = 0; do { sort(all(b)); do { int t = 0; rep(i, n) t += a[i] > b[i]; c += t > n / 2; s++; } while (next_permutation(all(b))); } while (next_permutation(all(a))); cout << prec(32) << 1.0 * c / s << endl; }