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