#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int main()
{
    int n,v[805],i,j,x,st,dr,mij,nr=0;
    fin >> n;
    for (i=1;i<=n;i++)
    {
        fin >> v[i];
    }
    sort(v+1,v+n+1);
    for (i=1;i<=n-2;i++)
    {
        for (j=i+1;j<=n-1;j++)
        {
            x=v[i]+v[j];
            st=j+1;
            dr=n;
            while (st<dr)
            {
                mij=(st+dr+1)/2;
                if (v[mij]<=x)
                {
                    nr=nr+mij-st+1;
                    st=mij+1;
                }
                else dr=mij-1;
            }
            while (v[st]<=x && st<=n)
            {
                nr=nr+1;
                st=st+1;
            }
        }
    }
    fout << nr;
}