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