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