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