import itertools import math n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) win_A = 0 for order_A in itertools.permutations(A): for order_B in itertools.permutations(B): point_A = 0 point_B = 0 for i in range(n): if order_A[i] > order_B[i]: point_A += 1 else: point_B += 1 if point_A > point_B: win_A += 1 num_mathces = math.factorial(n) ** 2 print(win_A / num_mathces)