#include <bits/stdc++.h>
using namespace std;
ifstream fin("nrtri.in");
ofstream fout("nrtri.out");
int n,st,dr,v[810],i,j,sol,mij,t;
int main()
{
    fin>>n;
    for(i = 1;i <= n;i++)
        fin>>v[i];
    sort(v + 1,v + n + 1);
    for(i = 1;i < n;i++)
        for(j = i + 1;j <= n;j++)
        {
            st = j + 1;dr = n;
            sol = 0;
            while(st <= dr)
            {
                mij = (st + dr) / 2;
                if(v[mij] <= v[i] + v[j])
                {
                    sol = mij;
                    st = mij + 1;
                }
                else
                    dr = mij - 1;
            }
            if(sol != 0)
              t += (sol - j);
        }
    fout<<t;
    return 0;
}