#include <algorithm>
#include <fstream>
using namespace std;
int i,j,n,v[805],sol,k;
int main()
{
ifstream f("nrtri.in");
ofstream g("nrtri.out");
    f>>n;
    for (i=1;i<=n;i++)
        f>>v[i];
    sort(v+1,v+n+1);
    for (i=1;i<=n-2;i++) {
        for (j=i+1;j<n;j++) {
                k=j+1;
          while (k<n && v[k]<=v[i]+v[j]) k++;
          if (k==n)
          {
            if (v[k]==v[i]+v[j]) sol+=k-j;
            else if (v[k]>v[i]+v[j]) sol+=k-j-1;
            else sol+=n-j;
          }
          else if (v[k]>v[i]+v[j]) sol+=k-j-1;
        }
    }
    g<<sol;
}