from itertools import permutations
from math import factorial
N = int(input())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

win = 0
for pa in permutations(A):
    for pb in permutations(B):
        cnt = sum(a > b for a, b in zip(pa, pb))
        win += 2 * cnt > N
ans = win / factorial(N) / factorial(N)
print("{:.10f}".format(ans))