#include <bits/stdc++.h>
#define NMAX 1002
 
using namespace std;
 
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
 
int N, sol, V[NMAX];

int search(int x) {
    return int(upper_bound(V + 1, V + N + 1, x) - V) - 1;
}
 
int main() {
    fin >> N;
    for (int i = 1; i <= N; ++i) {
        fin >> V[i];
    }
 
    sort(V + 1, V + N + 1);
 
    for (int i = 1; i <= N; ++i) {
        for(int j = i + 1; j <= N; ++j) {
            sol += search(V[i] + V[j]) - j;
        }
    }
    
    fout << sol << '\n';
}