#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int x,N,contor,r,l,i,v[801],j,n,nr;
int cautarebin(int x,int contor)
{
    int mijl,l=contor,r=N;
    while(l<=r)
    {
        mijl=(l+r)/2;
        if(x>=v[mijl])
            l=mijl+1;
        else
            r=mijl-1;
    }
    return r;
}
int main()
{
    fin>>N;
    for(int i=1; i<=N; i++)
        fin>>v[i];
    sort(v+1,v+N+1);
    for(int i=1; i<N; i++)
        for(int j=i+1; j<=N; j++)
        {
            n=cautarebin(v[i]+v[j],j);
            nr+=n-j;
        }
    fout<<nr;
    fin.close();
    fout.close();
    return 0;
}