#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int main()
{
    int n,V[805],st,dr,sol,S,mid,nrtri = 0;
    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++)
        {
            sol = 0;
            S = V[i] + V[j];
            st = j+1;
            dr = n;
            while(st<=dr)
            {
                mid = (st+dr)/2;
                if(V[mid]<=S)
                {
                    sol = mid-j;
                    st = mid+1;
                }
                else
                {
                    if(V[mid]>S)
                    {
                        dr = mid-1;
                    }
                }
            }
            nrtri = nrtri + sol;
        }
    }
    fout<<nrtri;
}