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