import itertools n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) a_perms = list(itertools.permutations(a)) b_perms = list(itertools.permutations(b)) count = 0 total = len(a_perms) * len(b_perms) for a_p in a_perms: for b_p in b_perms: a_win = 0 for i in range(n): if a_p[i] > b_p[i]: a_win += 1 if a_win > n // 2: count += 1 probability = count / total print("{0:.6f}".format(probability))