#include <iostream>
#include <fstream>
#include <algorithm>
using namespace std;
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int n,nrtri;
int B[801];
int BS(int x,int st,int dr){
    int rez=-1;
    while(st<=dr){
        int mij=st+(dr-st)/2;
        if(B[mij]<=x){
            rez=mij;
            st=mij+1;
        }
        else
            dr=mij-1;
    }
    return rez;
}
int main(){
    in>>n;
    for(int i=1;i<=n;++i)
        in>>B[i];
    sort(B+1,B+n+1);
    for(int i=1;i<n-1;++i)
        for(int j=i+1;j<n;++j){
            int x=B[i]+B[j];
            int rez=BS(x,j+1,n);
            if(rez>0)
                nrtri+=rez-j;
        }
    out << nrtri;
    return 0;
}