#include <bits/stdc++.h>
using namespace std;
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int c=0,low,hi,m,s;
int main() {
    int n,v[800],c=0;
    in>>n;
    for(int i=0;i<n;i++)
        in>>v[i];
    sort(v,v+n);
    for(int i=0;i<n;i++)
        for(int j=i+1;j<n;j++) {
        s=v[i]+v[j];
        low=j;
        hi=n-1;
        while(low<=hi) {
            m=low + (hi-low)/2;
        if(v[m]<=s)
            low=m+1;
        else hi=m-1;
        }
        c+=hi-j;
    }
    out<<c;
}