#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int n,v[802],i,j,sum,m,st,dr,nr;
int main()
{
    fin>>n;
    for(i=1;i<=n;i++)fin>>v[i];
    sort(v+1, v+n+1);
    for(i=1;i<=n;i++)
      for(j=i+1;j<=n;j++){
        sum=v[i]+v[j];
        st=1; dr=n; while(st<=dr){m=(st+dr)/2;
        if(v[m]<sum)st=m+1;
        else if(v[m]>sum)dr=m-1;
        else if(v[m]==sum){st=m; break;}
        }
        while(v[st]==sum)st++; st--;
        nr+=st-j;
    }
    fout<<nr;
    return 0;
}