#include <iostream>
#include <cstdio>
using namespace std;
int v[805];
int main()
{
    int i,n,j,mij,st,dr,aux,S=0,p;
    freopen("nrtri.in","r",stdin);
    freopen("nrtri.out","w",stdout);
    cin>>n;
    for(i=1;i<=n;i++)
        cin>>v[i];
    for(i=1;i<=n-1;i++)
        for(j=i+1;j<=n;j++)
            if(v[i]>v[j])
            {
                aux=v[i];
                v[i]=v[j];
                v[j]=aux;
            }
    for(i=1;i<=n-2;i++)
        for(j=i+1;j<=n-1;j++)
        {
            st=j+1;
            p=j;
            dr=n;
            while(st<=dr)
            {
                mij=(st+dr)/2;
                if(v[mij]>v[i]+v[j])
                    dr=mij-1;
                else
                {
                    p=mij;
                    st=mij+1;
                }
            }
            S=S+p-j;
        }
    cout<<S;
    return 0;
}