import           Data.Char
import qualified Data.ByteString.Char8 as B
import qualified Data.Vector.Unboxed   as U

main :: IO ()
main = do
  n <- readLn
  ps <- U.unfoldrN n (B.readInt . B.dropWhile isSpace) <$> B.getLine
  print $ solve n ps

solve :: Int -> U.Vector Int -> Int
solve n ps = n - 1 - (U.length $ U.uniq $ U.zipWith (<) ps $ U.tail ps)