#include <bits/stdc++.h>
#define ff first
#define ss second

using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pi;

const string file = "nrtri";
const ll INF = 9223372036854775807ll;
const int inf = 2147483647, nmax = 805;

int n, ans, v[nmax];

int main()
{
    ifstream fin (file+".in");
    ofstream fout (file+".out");
    fin >> n;
    for (int i = 1; i <= n; ++i)
        fin >> v[i];
    sort(v+1, v+n+1);
    for (int i = 1; i < n; ++i){
        int p1 = 0, p2 = 0;
        for (int j = i+1; j <= n; ++j){
            int a = v[i], b = v[j];
            while(p1+1 <= n && v[p1+1] < b-a)
                ++p1;
            while(p2+1 <= n && v[p2+1] <= b+a)
                ++p2;
            ans += p2-p1;
            if(i > p1 && i <= p2)
                --ans;
            if(j > p1 && j <= p2)
                --ans;
        }
    }
    fout << ans/3 << "\n";
    return 0;
}