import Control.Monad
import Data.Maybe
import qualified Data.ByteString.Char8 as BS
import Data.List

readInt = fst . fromJust . BS.readInt
readIntList = map readInt . BS.words
getInt = readInt <$> BS.getLine
getIntList = readIntList <$> BS.getLine

main = do
    n <- getInt
    ps <- getIntList
    print . solve $ zipWith (/=) [1..n] ps

solve [] = 0
solve (x:[]) | not x = 1
             | otherwise = 0
solve (x:xs) | not x = 1 + solve (tail xs)
             | otherwise = solve xs