#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int n, v[801], 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-1; i++)
    for(int j=i+1; j<n; j++)
        {
            int left, right, m;
            left=j;
            right=n;
            while(left<right)
            {
                if(right==left+1) m=right;
                else    m=(left+right)/2;
                if(v[m]>v[i]+v[j])
                    right=m-1;
                else left=m;
            }
            nr+=left-j;
        }
    fout<<nr;
    return 0;
}