#include<iostream>
#include<algorithm>
using namespace std;
int a[2005];
int main() {
	int n,m=0;
	cin >> n;
	for (int i = 1; i <= n; i++) {
		cin >> a[i];
	}
	sort(a + 1, a + n + 1);
	for (int i = 3; i <= n; i++) {
		for(int j=1;j<=i-1;j++)
			for (int k = 1; k < j; k++) {
				if (a[k] > a[i] - a[j])
					m++;
			}
	}
	cout << m;
	return 0;
}