import itertools n = int(input()) a = list(input().split()) b = list(input().split()) game = 0 wina = 0 for i in itertools.permutations(a, n): for j in itertools.permutations(b, n): for k in range(n): win = 0 lose = 0 if i[k] > j[k]: win += 1 elif i[k] < j[k]: lose += 1 game += 1 if win > lose: wina += 1 print(wina / game)