#include<stdio.h>

int n, a[200002],ans;
int main()
{
	scanf("%d", &n);
	for (int i = 1; i <= n; i++)
	{
		scanf("%d", &a[i]);
	}
	for (int i = 1; i < n; i++)
	{
		for (int j = i + 1; j <= n; j++)
		{
			if (j - i == a[j] + a[i])
				ans++;
		}
	}
	printf("%d", ans);
}