#include <bits/stdc++.h>
using namespace std;
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int n,i,j,st,dr,m,pos,ans;
int v[802];
int main()
{
    in>>n;
    for(i=1; i<=n; i++)
        in>>v[i];
    sort(v+1,v+1+n);
    for(i=1; i<n-1; i++)
        for(j=i+1; j<n; j++)
        {
            st=1;
            dr=n;
            while(st<=dr)
            {
                m=(st+dr)/2;
                if(v[m]>v[i]+v[j])
                    dr=m-1;
                else
                {
                    pos=m;
                    st=m+1;
                }
            }
            ans+=(pos-j);
        }
    out<<ans;
}