#include <iostream>
#include <algorithm>
#include <fstream>
using namespace std;
ifstream fin("nrtri.in");
ofstream fou("nrtri.out");
const int MAX = 800;
int N, i, v[1 + MAX], nr;
int main()
{
    fin >> N;
    for(int i = 1; i <= N; i++)
        fin >> v[i];
    sort(v + 1, v + N + 1);
    for(int i = 1; i < N; i++)
    {
        for(int j = i + 1; j < N; j++)
        {
            int st = j + 1, dr = N, s = v[i] + v[j], mid;
            while(st <= dr)
            {
                mid = (st + dr)/2;
                if(s >= v[mid])
                    st = mid + 1;
                else
                    dr = mid - 1;
            }
            nr += dr - j;
        }
    }
    fou << nr;
}