#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int n,i,j,x,st,dr,mid,cnt,v[801];
int main() {
    fin>>n;
    for (i=1;i<=n;i++)
        fin>>v[i];
    sort(v+1,v+n+1);
    for (i=1;i<n-1;i++)
        for (j=i+1;j<n;j++) {
            x=v[i]+v[j];
            st=j+1;
            dr=n;
            while (st<=dr) {
                mid=(st+dr)/2;
                if (x>=v[mid])
                    st=mid+1;
                else
                    dr=mid-1;
            }
            cnt+=dr-j;
        }
    fout<<cnt;
    return 0;
}