#include <fstream>
#include <algorithm>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int n,i,j,a,st,dr,mij,sol,v[900];
int main () {
    fin>>n;
    for (i=1;i<=n;i++) {
        fin>>v[i];
    }
    sort(v+1, v+n+1);
    for (i=1;i<=n-2;i++) {
        for (j=i+1;j<=n-1;j++) {
            a=v[i]+v[j];
            /// caut pozitia ultimei valori mai mica strict decat a
            st=j+1;
            dr=n;
            while (st<=dr) {
                mij=(st+dr)/2;
                if (v[mij]>a)
                    dr=mij-1;
                else
                    st=mij+1;
            }
            sol+=dr - j;
        }
    }
    fout<<sol;

    ///1 2 3 4 4 5 5 6 6 6 7 7 8 9 10 10 11 12 13
    ///  i       j
    /*for (i=1;i<n-1;i++) {
        for (j=i+1;j<=n-1;j++) {
            a=i+j;
            st=j+1;
            dr=n;
            sol=0;
            while (st<=dr) {
                mij=(st+dr)/2;
                if (v[mij]<a)
                    dr=mij-1;
                else {
                    sol=mij;
                    break;
                }
            }
            if (sol!=0)
                sfin++;
        }
    }
    fout<<sfin;*/
}