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