#include<stdio.h>

int main(){

    int N;
    scanf("%d", &N);
    
    int i,j, ans;
    int A[N+1];

    for( i = 1; i <= N; i++ ){
        A[i] = 0;
        scanf("%d", &A[i]);
    }

    for( i = 1; i <= N-1; i++ ){
        for( j = i+1; j <= N; j++ ){
//            printf("%d %d\n", i,j);
            if( A[i]+A[j] == j-i ) ans++;
        }
    }

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

    return 0;
}
