#include<stdio.h>

 int mabs(int a, int b) {
	a -= b;
	if (a >= 0)
		return a;
	else
		return (a*-1);
}

int main(void)
{
	int N;
	long long int sum = 0;
	long long int A[200001];
	scanf("%d", &N);

	for (int i = 0;i < N;i++) {
		scanf("%lld",&A[i]);
	}
	for (int i = 0;i < N - 1;i++) {
		for (int j = i + 1;j < N;j++) {
		//	printf("%lld %lld %d\n", A[i], A[j], mabs(i,j));
				if (A[i]+A[j] == mabs(i,j))
					sum++;
		}
	}


		printf("%lld",sum);

	return 0;
}