#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
int n;
int A[801];
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int main()
{
    int found=0;
    fin>>n;
    for(int i = 1;i<=n;i++)
        fin>>A[i];
    sort(A+1,A+n+1);
    for(int i = 1;i<=n;i++)
    {
        for(int j = i+1;j<=n;j++)
        {
            int s = A[i]+A[j];
            found+=(upper_bound(A+j+1,A+n+1,s)-A-j-1);
        }
    }
    fout<<found;
    return 0;
}