from itertools import permutations n = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) vs = 0 border = n//2 aaa = list(permutations(a, n)) bbb = list(permutations(b, n)) for aa in aaa: for bb in bbb: v = 0 for x, y in zip(aa, bb): if x > y: v += 1 if v > border: vs += 1 print(vs / (len(aaa) * len(bbb)))