#include<stdio.h>

int com(int*a, int n, int p, int count){
    int b=count;
    for(int i=p+1;i<n;i++)
        if((i-p)==(a[i]+a[p]))
            b+=1;
    if(p==n-2)
        return b;
    return com(a+1, n-1, p, b);
}

int main(){
    int n,count=0;
    scanf("%d",&n);
    int a[n];
    for(int i=0;i<n;i++)
        scanf("%d ",&a[i]);
    count=com(a, n, 0, 0);
    printf("%d",count);
    return 0;
}