-- Try AtCoder
-- author: Leonardone @ NEETSDKASU

import Data.List (sort)

main = getContents >>= print . solve . map read . words

solve (n:a) = ans where
    f (i, os, es) v = if even i then (i + 1, os, v : es) else (i + 1, v : os, es)
    (_, os, _) = foldl f (div n n, [], []) a
    g c _ _      []     = c
    g c i (x:xs) (y:ys)
        | x < y     = g c       (i + 1) xs (y:ys)
        | even i    = g (c + 1) (i + 1) xs ys
        | otherwise = g c       (i + 1) xs ys
    ans = g 0 1 (sort a) (sort os)
