from itertools import permutations N = int(input()) A = [int(i) for i in input().split()] B = [int(i) for i in input().split()] aw = 0 tn = 0 for permA in permutations(A): for permB in permutations(B): tn += 1 aw += sum(permA[i]>permB[i] for i in range(N)) > N//2 print(aw / tn)