import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List
import qualified Data.IntSet as S

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    as <- replicateM n getInt
    let ss = map snd . filter fst . zip (cycle [True, False]) $ sort as
    let cs = map snd . filter fst . zip (cycle [True, False]) $ as
    let set = S.fromList ss
    let ans = length $ filter (flip S.notMember set) cs
    print ans