#include <fstream>
#include <algorithm>
using namespace std;
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int v[805];
int main()
{
    int n,i,j,st,dr,mij,rez=-1,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)
        {
            st=j+1;dr=n;rez=-1;
            while(st<=dr)
            {
                mij=(st+dr)/2;
                if(v[i]+v[j]>=v[mij])
                {
                    rez=mij;
                    st=mij+1;
                }
                else
                    dr=mij-1;
            }
            if(rez>0)
                cnt=cnt+rez-j;
        }
    }
    out<<cnt;
    return 0;
}