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