#include<bits/stdc++.h>
using namespace std;
ifstream f("nrtri.in");
ofstream g("nrtri.out");
short n,b[801];
int sol;
int main()
{
    f>>n;
    for(int i=1;i<=n;++i)
        f>>b[i];
    sort(b+1,b+n+1);
    for(int i=1;i<n-1;++i)
        for(int j=i+1;j<n;++j)
    {
        int st=j+1;
        int dr=n;
        while(st<=dr)
        {
           int mij=(st+dr)/2;
            if(b[mij]<=b[i]+b[j])
                st=mij+1;
            else
                dr=mij-1;
        }
        sol+=dr-j;
    }
    g<<sol;
}