#include <fstream>
#include <algorithm>
#define MAX 801
using namespace std;
int v[MAX];
int main()
{
    int n, i, j, st, dr, mij, contor = 0, elem;
    ifstream fin("nrtri.in");
    ofstream fout("nrtri.out");
    fin >> n;
    for(i = 1; i <= n; i++)fin >> v[i];
    sort(v + 1, v + 1 + n);
    for(i = 1; i <= n - 2; i++)
    {
        for(j = i + 1; j <= n - 1; j++)
        {
            st = j + 1;
            dr = n;
            elem = -1;
            while(st <= dr)
            {
                mij = (st + dr) / 2;
                if(v[i] + v[j] < v[mij])dr = mij - 1;
                else
                {
                    elem = mij;
                    st = mij + 1;
                }
            }
            if(elem != -1)contor += elem - j;
        }
    }
    fout << contor;
    fin.close();
    fout.close();
    return 0;
}