import qualified Data.ByteString.Char8 as BS
import Data.Maybe (fromJust)

solve :: [Int] -> Int
solve [_,_] = 0
solve (x1:x2:x3:xs) = (if x1 == x3 then 0 else 1) + solve (x2:x3:xs)

main :: IO ()
main = do
    n <- readLn :: IO Int
    v <- map (fst . fromJust . BS.readInt)
        . BS.words <$> BS.getLine :: IO [Int]
    if n < 4 then print 0
       else if all (== head v) v then print $ length v `div` 2
       else print $ solve v
