#include <fstream>
#include <algorithm>
using namespace std;
int v[803];
int cb(int x, int n, int i, int j) {
  int st, mij, nsol, dr, ok = 0, sol;
  sol = 0;
  st = 0;
  dr = n - 1;
  while (st <= dr) {
    mij = (st + dr) / 2;
    if (v[mij] > x)
      dr = mij - 1;
    else {
      st = mij + 1;
      sol = mij;
    }
  }
  return sol - j;
}
int main() {
  ifstream cin ("nrtri.in");
  ofstream cout ("nrtri.out");
  int n, i, sol = 0, j, x;
  cin >> n;
  for (i = 0; i < n; i++)
    cin >> v[i];
  sort (v, v + n);
  for (i = 0; i < n; i++) {
    for (j = i + 1; j < n; j++) {
      if (i != j) {
        x = v[i] + v[j];
        sol += cb(x, n, i, j);
      }
    }
  }
  cout << sol;
  return 0;
}