#include <fstream>
#include <algorithm>
using namespace std;

ifstream fin("nrtri.in");
ofstream fout("nrtri.out");

int a[801], n;

int cb(int start, int val)
{
    int st = start, dr = n, mij;
    while (st <= dr)
    {
        mij = (st+dr)/2;
        if (a[mij] > val)
            dr = mij - 1;
        else
            st = mij + 1;
    }
    return st-1;
}

int main()
{
    int i, j;
    fin >> n;
    for (i = 1; i<=n; i++)
        fin >> a[i];
    sort(a+1, a+n+1);
    int nr = 0, poz;
    for (i = 1; i<n; i++)
        for (j = i+1; j<n; j++)
        {
            poz = cb(j+1, a[i]+a[j]);
            nr = nr + poz-j;
        }
    fout << nr;
    return 0;
}