#include using namespace std; int N; int A[5], B[5]; int C[5], D[5]; int cal(int x) { int sum = 1; for (int i = 1; i <= x; i++) sum *= i; return sum; } int main() { cin >> N; for (int i = 1; i <= N; i++) cin >> A[i]; for (int i = 1; i <= N; i++) cin >> B[i]; for (int i = 1; i <= N; i++) C[i] = i; int ans = 0; do { for (int i = 1; i <= N; i++) D[i] = i; do { int a = 0, b = 0; for (int i = 1; i <= N; i++) { if (A[C[i]] < B[D[i]]) b++; else if (A[C[i]] > B[D[i]]) a++; } if (a > b) ans++; } while(next_permutation(D + 1, D + N + 1)); }while(next_permutation(C + 1, C + N + 1)); cout << fixed << setprecision(10) << (double)((1.0 * ans) / (1.0 * cal(N) * cal(N))) << endl; return 0; }