#include <fstream>
#include <algorithm>
using namespace std;
ifstream f("nrtri.in");
ofstream g("nrtri.out");
int v[801];
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 n, i, j, k;
int main()
{

    f>>n;
    for (i=0; i<n;i++)
        f>>v[i];
    for(i = 0; i < n-1; i++)
        for(j = i + 1; j < n; j++)
            if(v[i]>v[j])
                swap(v[i],v[j]);
    for (i = 0; i < n - 1; i++)
    {
        for (j = i + 1; j < n; j++)
        {
            k += cautare(v[i] + v[j], j + 1, n) - j;
        }
    }
    g << k;
    return 0;
}