#include<fstream>
#include<algorithm>
using namespace std;
int v[801],s,S,i,j,dr,st,mij,n,p;

ifstream fin ("nrtri.in");
ofstream fout ("nrtri.out");
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++)
    {
        p=0;
        s=v[i]+v[j];
        st=j;
        dr=n;
        while(st<=dr){
            mij=(st+dr)/2;
        if(s<v[mij])
            dr=mij-1;
        else
        {st=mij+1;
         p=mij;}
        }
    if(p!=0)
        S+=+p-j;
            }
    fout<<S;
    return 0;
}