from itertools import groupby, accumulate, product, permutations, combinations from statistics import mean N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) ans = [] for p in permutations(A,N): for q in permutations(B,N): cnt = 0 for i in range(N): if p[i]>q[i]: cnt += 1 if cnt>N//2: ans.append(1) else: ans.append(0) ans = mean(ans) print(ans)