import qualified Data.ByteString.Char8 as C
import Data.Maybe ( fromJust )
import Data.List

cReadLn :: IO Int
cReadLn = fst . fromJust . C.readInt <$> C.getLine

getParms :: IO [Int]
getParms = map (fst . fromJust . C.readInt) . C.words <$> C.getLine

main :: IO ()
main = do
  n  <- cReadLn
  as <- getParms
  let p = f as
  print $ if p == n-1 
             then (n+1) `div` 2
             else p

f :: [Int] -> Int
f as = length . group . zipWith (<) as . tail $ as