#include <bits/stdc++.h>

using namespace std;

long v[900], i, j, k, n, r;

int main()

{
    ifstream f("nrtri.in");

    ofstream g("nrtri.out");

    f >> n;

    for (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++)

            for (k = j + 1; k <= n && v[k] <= v[i] + v[j]; k++)
                r++;

    g << r;

    return 0;
}