import itertools N = int(input()) a = list(map(int, input().split())) b = list(map(int, input().split())) per1 = itertools.permutations(list(range(N)), N) per2 = itertools.permutations(list(range(N)), N) cnt = 0 count = 0 c = 0 for xx in per2: for x in xx: for yy in per1: cnt = 0 for y in yy: if a[x]>b[y]: cnt += 1 c += 1 if cnt > N/2: count += 1 else: ans = cnt / c print(ans)