#include using namespace std; int main(void) { cin.tie(0); ios::sync_with_stdio(false); int n, t; vector a, b; cin >> n; for (int i = 0; i < n; i++) { cin >> t; a.push_back(t); } for (int i = 0; i < n; i++) { cin >> t; b.push_back(t); } double total = 0; double res = 0; sort(a.begin(), a.end()); do { sort(b.begin(), b.end()); do { int scoreA = 0; int scoreB = 0; for (int i = 0; i < n; i++) { if (a[i] > b[i]) { scoreA++; } else { scoreB++; } } if (scoreA > scoreB) { res++; } total++; } while (next_permutation(b.begin(), b.end())); } while (next_permutation(a.begin(), a.end())); cout << fixed; cout.precision(9); cout << (res / total) << '\n'; return 0; }