#include <fstream>
#include <algorithm>
using namespace std;
ifstream in ("nrtri.in");
ofstream out ("nrtri.out");
int v[801];
int main()
{
    int n,i,j,st,dr,k,mij,s,cnt,poz;
    cnt=0;
    in>>n;
    for(i=1;i<=n;i++)
        in>>v[i];
    sort(v+1,v+n+1);
    for(i=1;i<=n;i++)
    {
        for(j=i+1;j<=n;j++)
        {
            s=v[i]+v[j];
            st=j+1; dr=n;
            poz=-1;
            while(st<=dr)
            {
                mij=(st+dr)/2;
                k=v[mij];
                if(k<=s)
                {
                    poz=mij;
                    st=mij+1;
                }
                else
                    dr=mij-1;
            }
            if(poz!=-1)
                cnt+=poz-j;
        }
    }
    out<<cnt;
    return 0;
}