import itertools N=int(input()) A=list(map(int,input().split())) B=list(map(int,input().split())) casesA=itertools.permutations(A) casesB=itertools.permutations(B) ans=0 al=0 for a in casesA: for b in casesB: al+=1 wa=0 for ca,cb in zip(a,b): if ca>cb: wa+=1 if wa>N//2: ans+=1 ans/=al print(ans)