#include <fstream>
#include <algorithm>
using namespace std;
int n, i, j, k, sol, s, st, dr;
int v[810];
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-2;i++) {
        for (j=i+1;j<=n-1;j++) {
            s=v[i]+v[j];
            st=j+1;
            dr=n;
            while (st<=dr) {
                int mid = (st+dr)/2;
                if (v[mid]>s)
                    dr=mid-1;
                else
                    st=mid+1;
            }
            for (k=j+1;k<=dr;k++)
                sol++;
        }
    }
    fout<<sol;
    return 0;
}