import std.stdio, std.conv, std.string, std.range, std.algorithm, std.array,
  std.functional, std.container, std.typecons, std.math;

void main() {
  int N = readln.chomp.to!int;
  int[] L = readln.split.to!(int[]);

  L.sort!"a<b";

  ulong ans = 0;
  foreach(i; 0..(N-2)) {
    int a = L[i];
    foreach(j; (1+i)..(N-1)) {
      int b = L[j];
      int lower = abs(a-b);
      int upper = a+b;

      auto sorted = assumeSorted(L[(1+j)..N]);
      int lidx = cast(int)(sorted.lowerBound(lower).length);
      int uidx = cast(int)(sorted.lowerBound(upper).length)-1;

      ans += uidx - lidx + 1;
    }
  }
  ans.writeln;
}
