from itertools import permutations, product N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) result = [sum(1 if _a>_b else -1 if _a<_b else 0 for _a, _b in zip(al, bl)) > 0 for al, bl in product(permutations(a), permutations(b))] print(sum(result) / len(result))