#include <bits/stdc++.h>
using namespace std;
typedef long long LL;
#define mp make_pair
#define CHECK(x) if(!(x)) return false;
#define CHECKRET(x, y) if(!(x)) return (y);
#define SKIP(x) if((x)) continue;
typedef pair<int, int> pii;

#ifdef INFOARENA
#define ProblemName "nrtri"
#else
#define ProblemName "fis"
#endif

#define InFile ProblemName ".in"
#define OuFile ProblemName ".out"

const int MAXN = 810;
int v[MAXN];

int main() {
  assert(freopen(InFile, "r", stdin));
  assert(freopen(OuFile, "w", stdout));
  int N;
  scanf("%d", &N);
  for (int i = 0; i < N; ++i)
    scanf("%d", &v[i]);
  sort(v, v + N);
  int ans = 0;
  for (int i = 0; i < N; ++i)
    for (int j = i + 1; j < N; ++j) {
      int a = v[i], b = v[j];
      //a + b >= c
      int idx = upper_bound(v + j + 1, v + N, a + b) - v;
      ans += idx - (j + 1);
    }
  printf("%d\n", ans);
  return 0;
}