from itertools import permutations n = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) As = list(permutations(A, n)) Bs = list(permutations(B, n)) print(As) print(Bs) vic = 0 for a in As: for b in Bs: if sum([1 for i, j in zip(a, b) if i > j]) > int(n//2): vic += 1 print(vic / (len(As)*len(Bs)))