C++ code solution :
#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll ;
int main() {
/* Enter your code here. Read input from STDIN. Print output to STDOUT */
ll n;
cin>>n ;
ll a[n+1]={0};
ll v = 0 ;
while(v<=n-1){
cin>>a[v] ;
v++;
}
ll kk=0;
unordered_map <ll,ll> b ;
ll i = 0 ;
while(i<=n-1){
ll gg = a[i] + i*i ;
kk += (b[gg]);
b[gg]++;
i++;
}
cout<<kk;
return 0;
}