#include <cstdio>
#include <iostream>
#include <algorithm>
using namespace std;
 
int v[813],i,n;
 
int cautare(int a)
{
	int li=1,ls=n,rez=-1,mij;
	while(li<=ls)
	{
		mij=(li+ls)/2;
		if(v[mij]<=a) { rez=mij; li=mij+1;}
		else ls=mij-1;	
	}
	return rez;
	
	
}
 
int main()
{
	freopen("nrtri.in","r", stdin);
	scanf("%d",&n);
	for(i=1;i<=n;i++) scanf("%d",&v[i]);
	fclose(stdin);
	sort(v+1,v+n+1);
	int k,contor=0,j;
	
	for(i=1;i<=n;i++)
		for(j=i+1;j<=n;j++)
		{
			k=cautare(v[i]+v[j]);
			if(k>0) contor+=k-j;
		
		}
	freopen("nrtri.out","w", stdout);
	printf("%d",contor);
	fclose(stdout);
 
	return 0;
}