import Control.Applicative
import Data.List

findMatches :: [(Int, Int)] -> Int
findMatches [] = 0
findMatches ((x,y):xs) = a + findMatches xs
    where a = (x+y) `mod` 2

getMapping :: [(Int, Int)] -> Int -> [(Int, Int)]
getMapping [] _ = []
getMapping ((x, y):xs) p = (p,y):ys
    where ys = getMapping xs (p+1)

main :: IO ()
main = do
    n <- read <$> getLine
    raw <- mapM (\x -> (\s -> ((read :: String -> Int) s, x)) <$> getLine) [1..n]
    let xs = sort raw
        mp = getMapping xs 1
        res = (findMatches mp) `div` 2
    putStrLn . show $ res
