#include <fstream>
#include <algorithm>
#define NMAX 1001

using namespace std;

ifstream fin("nrtri.in");
ofstream fout("nrtri.out");

int N, sol, V[NMAX];

int search(int x) {
    int low = 0, high = N + 1, mid;

    while (high - low > 1) {
        mid = (low + high) / 2;
        if (V[mid] <= x) {
            low = mid;
        } else {
            high = mid;
        }
    }
    
    return low;
}

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';
}