#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int v[801];
int cb( int n, int ls, int x)
{
    int ld = n - 1, mij;
    while (ls <= ld)
    {
        mij = (ls + ld) / 2;
        if (v[mij] == x) return mij;
        if (v[mij] < x) ls = mij + 1;
        else ld = mij - 1;
    }
    return ld;
}
int main(void)
{
    int n, ct = 0;
    fin >> n;
    for (int i = 0; i < n; i++)
        fin >> v[i];
    sort(v, v + n);
    for (int i = 0; i < n - 1; i++)
    {
        for (int j = i + 1; j < n; j++)
        {
            int s = v[i] + v[j];
            int poz = cb( n, j + 1, s);
            while (v[poz] == v[poz + 1] && poz + 1 < n)
                poz++;
            ct += poz - j;
        }
    }
    fout << ct;
    return 0;
}