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 games = 0 win = 0 for a in permutations(A): for b in permutations(B): games += 1 if judge(a, b): win += 1 ans = win / games print(ans)