#include <fstream>
#include <algorithm>
using namespace std;
ifstream f("nrtri.in");
ofstream g("nrtri.out");
int n, v[805];
int bin(int lo , int hi , int val){
    int initial = lo - 1;
    int best = initial;
    int mid;
    while( lo <= hi){
        mid = (lo + hi) / 2;
        if(v[mid] > val)
            hi = mid - 1;
        else{
            lo = mid + 1;
            best = mid;
        }
    }
    return best - initial;
}
int main(){
    int i, x = 0, j;
    f >> n;
    for(i = 1 ; i <= n ; i++)
        f >> v[i];
    sort(v + 1, v + n + 1);
    for(i = 1 ; i < n ; i++)
        for ( j = i + 1 ; j < n ; j++){
            x += bin(j + 1 , n, v[i] + v[j]);
        }
    g << x ;
    return 0;
}