#include <cstdio>
#include <algorithm>
using namespace std;
int v[801];
//a+b>=c
int main()
{
    int n,i,t=0,j,st,dr,s,m,nr,poz;
    freopen("nrtri.in","r",stdin);
    freopen("nrtri.out","w",stdout);
    scanf("%d",&n);
    for(i=1;i<=n;i++)
    scanf("%d",&v[i]);
    sort(v+1,v+n+1);
    for(i=1;i<=n;i++)
        for(j=i+1;j<=n;j++)
        {
            s=v[i]+v[j];
            st=j+1;
            dr=n;
            poz=0;
            while(st<=dr)
            {
                m=(st+dr)/2;
                if(v[m]>s)dr=m-1;
                else
                {
                    poz=m;
                    st=m+1;
                }
            }
            if(poz!=0)
                t+=poz-j;
        }
        printf("%d",t);
    return 0;
}