//#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream cin("nrtri.in");
ofstream cout("nrtri.out");
int n,rasp,v[805];
int cautbin(int val){
    int st=1,dr=n,sol=0;
    while(st<=dr){
        int mid=(st+dr)/2;
        if(v[mid]<=val){
            sol=mid;
            st=mid+1;
        }
        else
            dr=mid-1;
    }
    return sol;
}
int main()
{
    cin>>n;
    for(int i=1;i<=n;i++){
        cin>>v[i];
    }
    sort(v+1,v+n+1);
    for(int i=1;i<=n;i++){
        for(int j=i+1;j<=n;j++){
            int a=v[i]+v[j];
            rasp+=max(0,cautbin(a)-j);
            //cout<<v[i]<<" "<<v[j]<<" "<<max(0,cautbin(a)-j)<<" "<<cautbin(a)<<"\n";
        }
    }
    cout<<rasp;
    return 0;
}