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