import qualified Data.List as L

toInt x = read x :: Int

main = do
    n <- toInt <$> getLine
    lst <- map toInt . words <$> getLine
    let lstA = zipWith (+) lst [1..]
        lstB = zipWith (-) [1..] lst
    print $ length $ lstA `L.intersect` lstB