import qualified Data.List as L

toInt x = read x :: Int

check :: [Int] -> [Int] -> [Int]
check [] _ = []
check [_] _ = []
check (x:xs) ys = (filter (==x) ys) ++ check xs ys

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