#include <bits/stdc++.h>

using namespace std;

ifstream in("nrtri.in");
ofstream out("nrtri.out");

const int dim = 810;

int n, v[dim], rez, p;

int main()
{
    in>>n;
    for(int i = 1;i <= n;i++)
        in>>v[i];
    sort(v + 1, v + n + 1);
    for(int i = 1;i <= n - 1;i++)
    {
        for(int j = i + 1;j <= n - 1;j++)
        {
            p = j + 1;
            while(v[i] + v[j] >= v[p] && p <= n)
                p++;
            rez += p - j - 1;
        }
    }
    out<<rez<<'\n';
    return 0;
}