#include <iostream>
#include <fstream>
#include <algorithm>

using namespace std;
ifstream f("nrtri.in");
ofstream g("nrtri.out");

int a[900],r,n;
int main()
{
    f>>n;
    for (int i=1;i<=n;i++)
        f>>a[i];
    sort(a+1,a+1+n);
    for (int i=1;i<n-1;i++)
        for (int j=i+1;j<n;j++)
    {
        int st=j+1,dr=n;
        while (st<=dr)
        {
            int m=(st+dr)/2;
            if (a[m]>a[i]+a[j])
                dr=m-1;
            else st=m+1;
        }
        r+=dr-j;
    }
    g<<r;
}