from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) wcnt = 0 bcnt = 0 for pa in permutations(A): for pb in permutations(B): w = 0 for a,b in zip(pa,pb): if a > b: w +=1 if w > N // 2: wcnt += 1 bcnt += 1 print(wcnt / bcnt)