program abc166e

integer n,ans,i,j
integer a(200000)

read(*,*) n
read(*,*) (a(i),i=1,n)

ans = 0
do i = 1,n
   do j = i+1,n
      if (a(i)+a(j) == j-i) then
         ans = ans + 1
      end if
   end do
end do

write(*,*) ans

end
