#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]; } int nBattle = 0; int nWin = 0; vector PermA(N), PermB(N); for(int i = 0; i < N; i++) { PermA[i] = i; PermB[i] = i; } do { do { int cntAWin = 0; for(int i = 0; i < N; i++) { if(A[PermA[i]] > B[PermB[i]]) { cntAWin++; } } int BWin = N-cntAWin; if(cntAWin > BWin) { nWin++; } nBattle++; } while (next_permutation(PermB.begin(), PermB.end())); } while (next_permutation(PermA.begin(), PermA.end())); double Ans = 1.0 * nWin / nBattle; cout << Ans << endl; }