#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
int v[803];
int main()
{
    int st,dr,mijl,i,n,poz,j,nr=0,p,min,aux;
    ifstream in("nrtri.in");
    ofstream out("nrtri.out");
    in>>n;
    for(i=1;i<=n;i++)
        in>>v[i];
    sort(v+1,v+n+1);
    for(i=1;i<=n-2;i++)
        for(j=i+1;j<=n-1;j++)
    {
        st=j+1;
        dr=n;
        poz=-1;
        while(st<=dr)
        {
            mijl=(st+dr)/2;
            if(v[mijl]>v[i]+v[j])dr=mijl-1;
            else {poz=mijl;
            st=mijl+1;}
        }
        if(poz!=-1)
        nr=nr+(poz-j);}
    out<<nr;
    return 0;
}