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