import itertools n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) game_count = 0 game_A = 0 for cards_a in list(itertools.permutations(A, n)): for cards_b in list(itertools.permutations(B, n)): win_a = 0 win_b = 0 for card_a, card_b in zip(cards_a, cards_b): if card_a > card_b: win_a += 1 elif card_b > card_a: win_b += 1 game_count += 1 if win_a > win_b: game_A += 1 print(game_A/game_count)