#include <fstream>
using namespace std;
ifstream in ("nrtri.in");
ofstream out ("nrtri.out");
int v[10007],sum[100007];
int main()
{
    int n,i,maxi=0;
    in>>n;
    for(i=1;i<=n;i++)
    {
        in>>v[i];
        sum[v[i]]++;
        maxi=max(maxi,v[i]);
    }
    for(i=1;i<=100000;i++)
        sum[i]+=sum[i-1];
    int j;
    int s;
    int a,x;
    int total=0;
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            s=v[i]+v[j];
            a=max(v[i],v[j]);
            x=a-min(v[i],v[j]);
            total+=(sum[s]-sum[x-1]);
            if(v[i]>=x&&v[i]<=s)
                total--;
            if(v[j]>=x&&v[j]<=s)
                total--;
        }
    }
    out<<total/3;
    return 0;
}