#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int v[800];
int cautare(int x, int st, int dr)
{
    int m;
    while (st < dr)
    {
        m = st + (dr - st) / 2;
        if (v[m] <= x)
            st = m + 1;
        else
            dr = m;
    }
    return st - 1;
}

int main()
{
    int n, i, j, poz, cnt;
    fin >> n;
    for (i = 0; i < n; i++)
        fin >> v[i];
    sort(v, v + n);
    cnt = 0;
    for (i = 0; i < n - 1; i++)
    {
        for (j = i + 1; j < n; j++)
        {
            cnt += cautare(v[i] + v[j], j + 1, n) - j;
        }
    }
    fout << cnt;
    return 0;
}