#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream f ("nrtri.in");
ofstream g ("nrtri.out");
int v[805];
int main()
{
    int n,i,j,st,dr,x,poz,ct,mijl;
    f>>n;
    for (i=1; i<=n; i++)
        f>>v[i];
    sort (v+1,v+n+1);
    ct=0;
    for (i=1; i<=n; i++)
        for (j=i+1; j<=n; j++)
        {
            x=v[i]+v[j];
            st=j+1;
            dr=n;
            poz=0;
            while (st<=dr)
            {
                mijl=(st+dr)/2;
                if (v[mijl]>x)
                    dr=mijl-1;
                else
                {
                    poz=mijl;
                    st=mijl+1;
                }
            }
            if (poz!=0)
                ct=ct+(poz-j);
        }
    g<<ct;
    return 0;
}