{-# LANGUAGE BangPatterns #-}

import qualified Data.IntMap as M

main :: IO ()
main = do
    n  <- readLn
    as <- map read . words <$> getLine
    print $ solve n as

solve :: Int -> [Int] -> Int
solve n as = go 0 $ M.fromList $ zip [1 .. n] as
  where
    go !n mp = case M.minViewWithKey mp of
        Nothing -> n
        Just ((k, a), mp') | M.lookup a mp' == Just k -> go (n + 1) mp'
                           | otherwise                -> go n mp'