#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int v[802];
int main()
{
    int n, rez = 0;
    fin >> n;
    for(int i = 0; i < n; i++)
        fin >> v[i];
    sort(v, v + n);
    for(int x2 = 1; x2 < n - 1; x2++)
    {
        int rez_actual = 0, x1 = 0, y = x2 + 1;
        while(x1 < x2)
        {
            while(v[x1] + v[x2] >= v[y] && y < n)
            {
                y++;
                rez_actual++;
            }
            rez += rez_actual;
            x1++;
        }
    }
    fout << rez;
    return 0;
}