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

int D[2003];
int main() {
	ios_base::sync_with_stdio(0), cin.tie(0);
	int N; cin >> N;
	for (int i = 0; i < N; ++i) cin >> D[i];
	sort(D, D + N);
	int ans = 0;
	for (int i = 0; i < N; ++i) {
		for (int j = i + 1; j < N; ++j) {
			ans += lower_bound(D + j, D + N, D[i] + D[j]) - D - j - 1;
		}
	}
	cout << ans;
	return 0;
}