import itertools def factorial(n): if n<=1: return 1 return n*factorial(n-1) N=int(input()) a_card=[int(x) for x in input().split(" ")] b_card=[int(x) for x in input().split(" ")] a_win_pattern=0 for i in itertools.permutations(a_card): for j in itertools.permutations(b_card): a_win=0 for k in range(N): if i[k]>j[k]: a_win+=1 if a_win>N-a_win: a_win_pattern+=1 print(a_win_pattern/factorial(N)**2)