#include <fstream>
#include <cassert>
using namespace std;
ifstream cin ("nrtri.in");
ofstream cout ("nrtri.out");
/*int Triangle (int a, int b, int c)
{
    return ((a+b>=c) && (b+c>=a) && (a+c>=b));
} */
void Swap(int &a, int &b)
{
    int temp;
    temp = b;
    b=a;
    a = temp;
}
void BubbleSort (int *v, int n) // v[]
{
    int i, j;
    for (i=1; i<=n; i++)
    {
        for (j=1; j<n; j++)
        {
            if (v[j]>v[j+1])
            {
                Swap (v[j],v[j+1]);
            }
        }
    }
}
int main()
{
    int N, V[803], contor=0;
    cin>> N;
    for(int i=1; i<=N; i++)
        cin>> V[i];
    BubbleSort(V,N);
    //for (int i=1; i<N; ++i)
     //   cout<<V[i]<<" ";
    for (int i=1; i<=N; i++)
    {
        int k=i+1;
        for (int j=i+1; j<=N;j++)
        {
            while (k<=N && V[i]+V[j]>=V[k])
                ++k;
            contor+=k-j-1;

        }
    }
    cout<<contor;
    return 0;
}