#include <fstream>
#include <algorithm>
using namespace std;
int v[800];
int main()
{
    int n, i, j, k, rasp;
    
    ifstream f ("nrtri.in");
    ofstream g ("nrtri.out");
    
    f >> n;
    
    for (i = 0; i < n; i++){
        f >> v[i];
    }
    
    sort(v, v + n);
    
    rasp = 0;
    for (k = n - 1; k > 1; k--){
        i = 0;
        j = k - 1;
        while(i < j){
            if (v[i] + v[j] < v[k]){
                i++;
            }else{
                rasp += j - i;
                j--;
            }
        }
    }
    
    g << rasp;
    
    f.close();
    g.close();
    return 0;
}