#include <cstdio>
#include <algorithm>
using namespace std;
int v[801];
int main (){
    freopen ("nrtri.in","r",stdin);
    freopen ("nrtri.out","w",stdout);
    int i,n,j,s,l1,l2,m,poz,nr=0;
    scanf ("%d",&n);
    for (i=1;i<=n;i++)
        scanf ("%d",&v[i]);
    sort(v+1,v+n+1);
    for (i=1;i<=n;i++)
        for (j=i+1;j<=n;j++){
            s=v[i]+v[j];
            l1=1;
            l2=n;
            while (l1<=l2){
                m=(l1+l2)/2;
                if (v[m]>s)
                    l2=m-1;
                else{
                    poz=m;
                    l1=m+1;
                }
            }
            nr=nr+poz-j;
        }
    printf ("%d",nr);
    return 0;
}