#include<fstream>
#include<algorithm>
using namespace std;
ifstream cin("nrtri.in");
ofstream cout("nrtri.out");
int n,a[1005],ans;
int cbr(int x){
    int step=1;
    while(step<=n) step<<=1;
    int i=0;
    while(step>0){
        if(i+step<=n && a[i+step]<=x)
            i+=step;
        step>>=1;
    }
    return i;
}
int main(){
    cin>>n;
    for(int i=1;i<=n;i++)
        cin>>a[i];
    sort(a+1,a+n+1);
    int r,d;
    for(int i=1;i<n;i++)
        for(int j=i+1;j<=n;j++){
        r=cbr(a[j]+a[i]);
        d=r-j;
        ans+=d;
    }
    cout<<ans;
}