#include <bits/stdc++.h>
using namespace std;
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int a[805],n;
int cauta(int s,int p)
{
    int st = p + 1,dr = n,mij;
    while (st <= dr)
    {
        mij = (st + dr) / 2;
        if (a[mij] > s)
            dr = mij - 1;
        else if (a[mij] <= s)
            st = mij + 1;
    }
    //cout << st << " " << dr << '\n';
    return dr - p;
}
int main()
{
    int i,j,sol = 0;
    in >> n;
    for (i = 1; i <= n; i++)
        in >> a[i];
    sort(a + 1,a + n + 1);
    for (i = 1; i < n - 1; i++)
        for (j = i + 1; j < n; j++)
        {
            sol += cauta(a[i] + a[j],j);
            //cout << cauta(a[i] + a[j],j) << " " << i << " " << j << '\n';
        }
    out << sol;
    return 0;
}