#include <fstream>
#include <algorithm>
using namespace std;
ifstream f("nrtri.in");
ofstream g("nrtri.out");
int n, v[805], sol;
void citire(int &n, int v[])
{
    f >> n;
    for(int i = 1; i <= n; ++ i)
        f >> v[i];
}
int main()
{
    citire(n, v);
    sort(v + 1, v + n + 1);
    for(int i = 1; i <= n - 2; ++ i)
        for(int j = i + 1; j <= n - 1; ++ j)
        {
            long s = v[i] + v[j];
            int st = j + 1, dr = n;
            while (st <= dr)
            {
                int mid = (st + dr) / 2;
                if (v[mid] > s)
                    dr = mid - 1;
                else
                    st = mid + 1;
            }
            sol += dr - j;
        }
    g << sol;
    f.close();
    g.close();
    return 0;
}