#include <bits/stdc++.h>
using namespace std;

int main(int argc, char const *argv[])
{
	int n;
	cin>>n;
	int l[n];
	for (int i = 0; i < n; ++i)
	{
		cin>>l[i];
	}
	sort(l,l+n);
	int ans=0;
	for (int i = 0; i < n; ++i)
	{
		for (int j = i+1; j < n; ++j)
		{
			int ng=distance(lower_bound(l,l+n,l[i]+l[j]),l+n);
			ans+=n-j-1-ng;
		}
	}
	cout<<ans<<endl;
	return 0;
}
