import random from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) def judge(xs, ys): win = 0 for x, y in zip(xs, ys): if x > y: win += 1 else: win -= 1 return win > 0 trials = 1_000_000 win = 0 for _ in range(trials): a = A[:] b = B[:] random.shuffle(a) random.shuffle(b) if judge(a, b): win += 1 ans = win / trials print(ans)