import math import itertools n = int(input()) a = list(itertools.permutations(list(map(int,input().split())))) b = list(itertools.permutations(list(map(int,input().split())))) won = 0 lost = 0 for i in range(math.factorial(n)): for j in range(math.factorial(n)): win = 0 lose = 0 for x in zip(a[i],b[j]): if x[0] > x[1]:win +=1 if x[0] <= x[1]:lose += 1 if win > lose: won += 1 else:lost += 1 print(won/(won+lost))