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