#include<bits/stdc++.h>
using namespace std;
int n;
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int v[805];
int cbin(int val)
{
    int st=1,dr=n,ok=-1;
    while(st<dr)
    {
        int mid=(st+dr)/2;
        if(v[mid]<=val)
        {
            st=mid+1;
            ok=max(mid,ok);
        }
        else
        {
            dr=mid-1;
        }
    }
    if(v[st]<=val)
        ok=st;
    return ok;
}
int main()
{
    long long ans = 0;
    int val;
    in>>n;
    for(int i=1;i<=n;i++)
        in>>v[i];
    for (int t=1; t<=n; ++t) {
        for(int i=1;i<n;i++)
        {
            if(v[i]>v[i+1])
            {
                int a=v[i];
                v[i]=v[i+1];
                v[i+1]=a;
            }
        }
    }
    for(int i=1;i<=n-2;i++)
    {
        for(int j=i+1;j<=n-1;j++)
        {
            int a = max(cbin(abs(v[i] - v[j])) - 1, j);
            int b = max(cbin(v[i] + v[j]), j);
            ans+= b-a;
        }
    }
    out<<ans<<'\n';
    return 0;
}