#カードゲーム #https://yukicoder.me/problems/199 from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) A_perm = list(permutations(A)) B_perm = list(permutations(B)) ans = 0 for a in A_perm: for b in B_perm: awin = 0 bwin = 0 for an,bn in zip(a,b): if an > bn: awin += 1 else: bwin += 1 if awin > bwin: ans += 1 print(ans/(len(A_perm)*len(B_perm)))