#include <stdio.h>
#include <stdlib.h>
#include <string.h>
 
int main(void){
	int N,*A;
	int i,j;
	int ans;
	char str[1000];
 
	fgets(str, sizeof(str), stdin);
	N=atoi(strtok(str," "));
	A=(int*)calloc(N,sizeof(int));

	fgets(str, sizeof(str), stdin);
	A[0]=atoi(strtok(str," "));
	for(i=1;i<N;i++){
		A[i]=atoi(strtok(NULL," "));
	}

	ans=0;
	for(i=0;i<N;i++){
		for(j=i+1;j<N;j++){
			if( abs(j-i) == (A[i]+A[j]) ) ans++;
		}
	}

	printf("%d\n",ans);

	free(A);

	return 0;
}