import itertools N = int(input()) A = input().split() B = input().split() cnt = 0 all = 0 for i in itertools.permutations(A): for j in itertools.permutations(B): a_win = 0 a_lose = 0 for k in range(N): if int(i[k]) > int(j[k]): a_win += 1 if int(i[k]) > int(j[k]): a_lose += 1 else: all += 1 if a_win > a_lose: cnt += 1 print(cnt/all)