#include <fstream>
#include <algorithm>
using namespace std;
int a[805];
int main()
{
    ifstream f("nrtri.in");
    ofstream g("nrtri.out");
    int i,j,n;
    int suma,left,right,mid;
    int ans,contor = 0;
    f>>n;
    for (i=1; i<=n; i++)
        f>>a[i];
    sort(a+1,a+n+1);
    for (i=1; i<n; i++)
    {
        for (j= i + 1 ; j<n; j++)
        {
            suma = a[i] + a[j];
            left = j + 1;
            right = n;
            ans = j;
            while (left <= right)
            {
                mid = (left + right)/2;
                if (a[mid] <= suma)
                {
                    ans = mid;
                    left = mid + 1;
                }
                else
                    right = mid - 1;
            }
            contor += ans - j;
            /*if (a[ans] > a[j] - a[i] + 1)
            {
                contor += ans - j;
                ///g<< i << " " << " " << j << " " << ans << "\n";
            }*/
        }
    }
    g << contor;
    return 0;
}