#include <iostream>
#include <fstream>
#include <vector>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int n, v[803];
int main()
{
    fin >> n;
    for (int i = 0, x; i < n; i++)
        fin >> v[i];
    sort(v, v+n);

    int res = 0;
    for (int i = 0; i < n - 2; i++)
    {
        for (int j = i + 1; j < n - 1; j++)
        {
            int val = v[i] + v[j];
            auto it = upper_bound(v+j-1, v+n, val);
            it--;
            int p = it - v;
            res += (p - j);
        }
    }
    fout << res;

    return 0;
}