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