#include<fstream>
#include<algorithm>
using namespace std;
int v[1000];
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int main ()
{
    int n,x,y,p1,p2,s=0;
    in>>n;
    for(int i=1; i<=n; i++)
        in>>v[i];
    sort(v+1,v+n+1);
    for(int i=1;i<=n-2;i++)
        for(int j=i+1;j<=n-1;j++) {
            x=v[i];
            y=v[j];
            p1=j;
            p2=j;
            for(int msk=1<<20;msk>0;msk/=2)
                if(p1+msk<=n && v[p1+msk]<=x+y)
                    p1+=msk;
            for(int msk=1<<20;msk>0;msk/=2)
                if(p2+msk<=n && v[p2+msk]<abs(x-y))
                    p2+=msk;
            s+= p1 - p2;
        }
    out<<s;
    return 0;
}