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;

  foreach(i; 0..N) {
    for(int j=i+1; j<N; j++) {
      for(int k=j+1; k<N; k++) {
        combinations ~= [Ln[i], Ln[j], Ln[k]];
      }
    }
  }

  int total = 0;
  foreach(lines; combinations) {
    if (lines[0] >= lines[1] + lines[2]) continue;
    if (lines[1] >= lines[2] + lines[0]) continue;
    if (lines[2] >= lines[0] + lines[1]) continue;
    total++;
  }

  writeln(total);
}
