from itertools import permutations N = int(input()) A = tuple(map(int, input().split())) B = tuple(map(int, input().split())) judge = N // 2 cnt1 = 0 cnt2 = 0 for cards_A in permutations(A): for cards_B in permutations(B): cnt1 += 1 point = 0 for ca, cb in zip(cards_A, cards_B): if ca > cb: point += 1 if point > judge: cnt2 += 1 print(cnt2 / cnt1)