N = gets.to_i A = gets.split.map(&:to_i) B = gets.split.map(&:to_i) M = 100000 m = M.times.count do A.shuffle! B.shuffle! N.times.count{|i| A[i] > B[i] } > N / 2 end puts m.to_f / M