import Control.Monad (replicateM)
import Data.List (sort)

main = do
    n <- readLn :: IO Int
    answer <- length . filter odd . evenSnds . sort . (`zip` [0..]) <$> replicateM n ((read :: String -> Int) <$> getLine)
    print answer
  where evenSnds ((x, i):ps) = i:(evenSnds (drop 1 ps))
        evenSnds _ = []