main = do
    n <- readLn :: IO Int
    xs <- map read.words <$> getLine :: IO [Int]
    print $ answer n xs

answer n hs = length $ filter judge [(i,j) | i <- [0..n-1], j <- [0..n-1], i < j] where
    judge (i,j) = abs (i-j) ==hs!!i + hs!!j