from itertools import permutations N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) if N == 1: if A[0] > B[0]: print(1) else: print(0) exit() win = 0 for a in permutations(A, N): for b in permutations(B, N): cnt = 0 for i in range(N): if a[i] > b[i]: cnt += 1 if cnt > N // 2: win += 1 print(win / (N * (N - 1))**2)