#include <fstream>
#include <algorithm>
using namespace std;
int v[800];
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int cautbin(int val, int marime)
{
    int pos =0 ;
    for(int msk=1<<9; msk>0; msk/=2)
        if(msk+pos<=marime && v[msk+pos]<=val)
            pos += msk;
    return pos;
}
int main()
{
    int n, nrt=0,  nr, k;
    in >> n;
    for(int i=1; i<=n; i++)
        in >> v[i];
    sort(v+1, v+n+1);
    for(int i=1; i<=n; i++)
    {
        for(int j=i+1; j<=n; j++)
        {
            nr = cautbin(v[i] + v[j], n);
            if(nr>j)
                nrt += nr-j;
        }
    }
    out << nrt;
    return 0;
}