#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()); double ret = 0; do { int now = 0; for (int i = 0; i < n; i++) { if (a[i] > b[i])now++; } if (now > n - now)ret++; } while (next_permutation(a.begin(), a.end())); double fact = 1; for (int i = 1; i <= n; i++)fact *= i; cout << ret / fact << endl; return 0; }