import sys import numpy as np #from numba import njit, b1, i1, i4, i8, f8, jitclass sys.setrecursionlimit(10**9) from itertools import permutations read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines def input(): return sys.stdin.readline().strip() #""" def from_read(dtype=np.int64): return np.fromstring(read().decode(), dtype=dtype, sep=' ') def from_readline(dtype=np.int64): return np.fromstring(readline().decode(), dtype=dtype, sep=' ') #""" #@njit("(i8,i8,i8,i8[:],i8[:],)", cache=True) def main(N, A, B): total = 1 for i in range(1, N + 1): total *= i total *= total ans = 0 for a in permutations(A, N): for b in permutations(B, N): win = 0 for aa, bb in zip(a, b): win += 1 if aa > bb else 0 ans += 1 if win > N // 2 else 0 print(ans / total) if __name__ == '__main__': N = int(input()) A = list(map(int, input().split())) B = list(map(int, input().split())) main(N, A, B)