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