import std.stdio, std.string, std.array, std.conv, std.algorithm;

void main() {
    int n = readln.chomp.to!int;
    int[] l = readln.chomp.split.to!(int[]);
    l.sort;
    int sum = 0;
    foreach (i; 0 .. n-2) {
        foreach (j; i+1 .. n-1) {
            sum += count!("a < b")(l[j+1..$], l[i]+l[j]);
        }
    }
    sum.writeln;
}