#include <fstream>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int n,i,j,v[803],s,st,dr,mid,ultimul,sol;
int main()
{
    fin>>n;
    for(i=1;i<=n;i++)
        fin>>v[i];
    for(i=1;i<=n-1;i++)
        for(j=i+1;j<=n;j++)
            if(v[i]>v[j])swap(v[i],v[j]);
    v[n+1]=90000;
    for(i=1;i<=n-2;i++)
        for(j=i+1;j<=n-1;j++)
        {
            s=v[i]+v[j];
            st=j+1;dr=n;
            ultimul=0;
            while(st<=dr)
            {
                mid=(st+dr)/2;
                if(v[mid]<=s && v[mid+1]>s)
                {
                    ultimul=mid;
                    break;
                }
                else if(v[mid]<=s)
                    st=mid+1;
                else
                    dr=mid-1;
            }
            if(ultimul!=0)
                sol+=ultimul-j;
        }
    fout<<sol;
    return 0;
}