import sys read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines import itertools N,*AB = map(int,read().split()) A = AB[:N] B = AB[N:] perm_A = itertools.permutations(A) perm_B = itertools.permutations(B) match = 0 win = 0 for p,q in itertools.product(perm_A, perm_B): match += 1 large = sum(x > y for x,y in zip(p,q)) small = N - large if large > small: win += 1 print(win / match)