import std.conv, std.stdio, std.algorithm, std.string, std.range, std.math;

void main() {
  readln;
  const l  = readln.split.map!(to!int).array.sort!"a<b".array;
  
  const n = l.length;
  int ans;
  
  auto ls = l.assumeSorted;
  foreach_reverse (long mid; 0..n) foreach_reverse (long low; 0..mid) {
    ans += ls.lowerBound(l[mid]+l[low]).count - 1 - mid;
  }
  
  ans.writeln;
}