import std.stdio, std.conv, std.array, std.string;
import std.algorithm;
import std.container;
import std.range;
import core.stdc.stdlib;
import std.numeric;
import std.math;

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

  int total = 0;
  foreach(i; 0..N) {
    auto a = Ln[i];
    for(int j=i+1; j<N; j++) {
      auto b = Ln[j];
      auto k1 = a-b;
      auto k2 = -k1;
      auto k3 = a+b;
      for(int k=j+1; k<N; k++) {
        auto c = Ln[k];
        if (k1 >= c || k2 >= c || c >= k3) continue;
         total++;
      }
    }
  }

  writeln(total);
}
