#include <fstream>
#include <cstring>
#include <algorithm>
using namespace std;
int n,v[810],i,j,st,dr,mid,sol;
int main () {
    ifstream fin ("nrtri.in");
    ofstream fout ("nrtri.out");
    fin>>n;
    for (i=1;i<=n;i++){
        fin>>v[i];
    }
    sort (v+1,v+n+1);
    for (i=1;i<n-1;i++){
        for (j=i+1;j<n;j++){
            st=j+1;
            dr=n;
            while (st<=dr){
                mid=(st+dr)/2;
                if (v[mid]<=v[i]+v[j]){
                    st=mid+1;
                }
                else
                    dr=mid-1;
            }
            sol+=dr-j;
        }
    }
    fout<<sol;
    return 0;
}