#include<bits/stdc++.h>
using namespace std;

int  binary_search(int a[],int q, int n, int x)
{
    int l=q,h=n,mid,ans=0;
    while(l<=h)
    {
        mid = (l+h)/2;
        if(a[mid]<=x){
            l = mid+1;
        }
        else{
            //ans=mid - h;
            h = mid-1;
        }
    }
    return ans;
}

int main()
{
    int n,x1=0,x2=0;
    cin>>n;
    int ar[n];
    for(int i=1; i<=n; i++)
    {
        cin>>ar[i];
    }
    sort(ar+1,ar+n+1);
    for(int i=1; i<=n; i++)
    {
        for(int j=i+1;j<=n;j++)
        {
            int x = ar[i]+ar[j];
             //x1 = binary_search(ar,j+1,n,x);
             x1 = upper_bound(ar,ar+n,ar[j])-ar;
             x2+=(n-x1);
        }
    }
    cout<<x2<<endl;
    //cout<<endl;
}
