#include <cstdio>
#include <algorithm>
using namespace std;
int N, List[805], i, S, j;
int Binary(int st, int dr, int Find){
    int inplus=st-1, mij;
    while(st<dr){
        mij=(st+dr)/2;
        if(Find==List[mij]){st=mij; break;}
        if(Find>List[mij]) st=mij+1;
        else dr=mij-1;
    }
    if(List[st]==Find)while(List[st+1]==List[st])st++;
    if(Find<List[st])inplus++;
    return st-inplus;
}
int main()
{
    freopen("nrtri.in", "r", stdin);
    freopen("nrtri.out", "w", stdout);
    scanf("%d", &N);
    for(i=1; i<=N; i++) scanf("%d", &List[i]);
    sort(List+1, List+N+1);
    for(i=1; i<=N-2; i++)
    for(j=i+1; j<=N-1; j++)
        S+=Binary(j+1, N, List[i]+List[j]);
    printf("%d", S);
    return 0;
}
/*#include <iostream>
#include <algorithm>
#include <fstream>
#define MAX 800
using namespace std;
int main(){
 ifstream in("nrtri.in");
 ofstream out("nrtri.out");
 int nr, i, j, k, arr[MAX];
 in >> nr;
 for (i = 0; i != nr; i++){
    in >>arr[i];
 }
 sort(arr, arr + nr);
 int sum = 0;
 for (i = 0 ;i < nr; i++){
    for (j = i + 1 ;j < nr; j++){
        for (k = j + 1 ;k < nr; k++){
          if(arr[i] + arr[j] >= arr[k] && arr[i] + arr[k] >= arr[j] && arr[k] + arr[j] >= arr[i] ) {
                sum++;
          }
          else break;
        }
    }
 }
 out <<sum << endl;
}*/