import itertools import numpy as np N = int(input()) cards_a = list(map(int, input().split())) cards_b = list(map(int, input().split())) total = 0 win_a = 0 for pattern_a in itertools.permutations(cards_a): for pattern_b in itertools.permutations(cards_b): pattern_a = np.array(list(pattern_a)) pattern_b = np.array(list(pattern_b)) fight = np.sum(pattern_a > pattern_b) if fight > N - fight: win_a += 1 total += 1 print(win_a / total)