#include <iostream>
#include <fstream>
#include <cstring>
#include <algorithm>
using namespace std;
ifstream f("nrtri.in");
ofstream g("nrtri.out");
int n, v[805], i, j, raspuns;
int cautareBinara(int j) {
	int stanga = j + 1, dreapta = n, t = v[i] + v[j];
	while (stanga <= dreapta) {
		int mijloc = (stanga + dreapta) / 2;
		if (t < v[mijloc])
			dreapta = mijloc - 1;
		else
			stanga = mijloc + 1;
	}
	return raspuns + dreapta - j;
}
int main() {
	f >> n;
	for (int i = 1; i <= n; i++)
		f >> v[i];
	sort(v + 1, v + n + 1);
	for (i = 1; i < n; i++)
		for (j = i + 1; j <= n; j++)
			raspuns = cautareBinara(j);
	g << raspuns << " ";
	return 0;
}