from itertools import combinations, permutations, product from math import factorial n=int(input()) al=list(map(int,input().split())) bl=list(map(int,input().split())) cnt=0 for ao in permutations(al): for bo in permutations(bl): win=0 lose=0 for i in range(n): if ao[i]>bo[i]: win+=1 elif ao[i]lose: cnt+=1 allpattern=factorial(n)**2 print(cnt/allpattern)