from itertools import permutations n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) As = list(permutations(A, n)) Bs = list(permutations(B, n)) vic = 0 thr = n//2 for a in As: for b in Bs: tmp = len([i for i, j in zip(a, b) if i > j]) if tmp > thr: vic += 1 print(vic / (len(As)*len(Bs)))