#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream f("nrtri.in");
ofstream g("nrtri.out");
const int NMAX=800;
int v[NMAX+1],n;
int caut1(int x,int inceput)
{
    int p=inceput,u=n,poz=-1,m;
    while(p<=u)
    {
        m=(p+u)/2;
        if(x>=v[m])
        {
            poz=m;
            p=m+1;
        }
        else
            u=m-1;
    }
    return poz;
}
int main()
{
    f>>n;
    int s=0;
   for(int i=1; i<=n; i++)
        f>>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++)
            s+=(caut1(v[i]+v[j],i+1)-j);
    g<<s;
}