#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()); double ans = 0; int c = 0; do { do { c++; int cnt1 = 0, cnt2 = 0; for (int i = 0; i < n; i++) { cnt1 += (a[i] > b[i]); cnt2 += (a[i] < b[i]); } ans += (cnt1 > cnt2); } while (next_permutation(b.begin(), b.end())); } while (next_permutation(a.begin(), a.end())); ans /= c; cout << ans << "\n"; return 0; }