n = gets.to_i
a = gets.split.map &:to_i
b = gets.split.map &:to_i

x, y = 0, 0
a.permutation do |a_|
    b.permutation do |b_|
        cnt = (0...n).to_a.count { |i| a_[i] > b_[i] }
        x += 1 if cnt > (n - cnt)
        y += 1
    end
end
puts x / y.to_f