#include <fstream>
#include <algorithm>
using namespace std;
ifstream in("nrtri.in");
ofstream out("nrtri.out");
int v[801];
int main()
{
    int n;
    long long s = 0;
    in >> n;
    for (int i = 1; i <= n; ++i)
        in >> v[i];
    sort(v + 1, v + n + 1);
    for (int i = 1; i < n; ++i)
    {
        for (int j = i + 1; j <= n; ++j)
        {
            int poz, lg;
            for (lg = 1; lg <= n; lg <<= 1);
            for (poz = 1; lg; lg >>= 1)
            {
                if (poz + lg <= n && v[poz + lg] <= v[i] + v[j])
                    poz += lg;
            }
            s += poz - j;
        }
    }
    out << s;
    return 0;
}