#include <bits/stdc++.h>
using namespace std;
ifstream f("nrtri.in");
ofstream g("nrtri.out");
const int MAX = 8e2 + 5;
int n, answer;
int v[MAX];
int Binary_Search(int i, int j)
{
    int r = 0, pas = 1 << 15;
    while(pas)
    {
        if(r + pas <= n && v[r + pas] <= v[i] + v[j])
            r+=pas;
        pas/=2;
    }
    return r;
}
int main()
{
    f >> n;
    for(int i = 1; i <= n; ++i)
        f >> v[i];
    sort(v + 1, v + n + 1);
    for(int i = 1; i <= n - 1; ++i)
        for(int j = i + 1; j <= n; ++j)
            answer += Binary_Search(i, j) - j;
    g << answer << "\n";
    return 0;
}