import Control.Monad import Data.List getInts :: IO [Int] getInts = liftM (map read . words) getLine main = do n <- readLn as <- getInts bs <- getInts let ps = permutations bs f a b = if a > b then 1 else 0 g x = if x > n `div` 2 then 1 else 0 s = sum $ map (g . sum . zipWith f as) ps p = fromIntegral s / fromIntegral (product [1..n]) in print p