/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <bits/stdc++.h>
using namespace std;
ifstream fin ("nrtri.in");
ofstream fout ("nrtri.out");
int v[1000],n;
int cb (int j, int i)
{
int st=j+1,poz=j,dr=n;
while (st<=dr)
{
int mij = (st+dr)/2;
if (v[mij]<=v[i]+v[j])
{
poz = mij;
st = mij+1;
}
else dr = mij - 1;
}
return poz-j;
}
int main()
{
int i,j;
fin>>n;
for (i=1;i<=n;i++)
{
fin>>v[i];
}
sort(v+1,v+n+1);
long long cnt = 0;
for (i=1;i<=n;i++)
{
for (j=i+1;j<=n;j++)
{
int st=j+1, dr=n;
cnt+=cb(j,i);
}
}
fout<<cnt;
return 0;
}