from bisect import*
n, *l = map(int, open(0).read().split())
l.sort()
print(sum(max(0, bisect_left(l, l[i] + l[j]) - j - 1) for i in range(n) for j in range(i+1, n))) from bisect import* n, *l = map(int, open(0).read().split()) n map(int, open(0).read().split()) map int open(0).read().split() (0).read().split (0).read() (0).read (0) open 0 read split *l l l.sort() l.sort l sort print(sum(max(0, bisect_left(l, l[i] + l[j]) - j - 1) for i in range(n) for j in range(i+1, n))) print sum(max(0, bisect_left(l, l[i] + l[j]) - j - 1) for i in range(n) for j in range(i+1, n)) sum max(0, bisect_left(l, l[i] + l[j]) - j - 1) max 0 bisect_left(l, l[i] + l[j]) - j - 1 bisect_left(l, l[i] + l[j]) - j bisect_left(l, l[i] + l[j]) bisect_left l l[i] + l[j] l[i] l i l[j] l j j 1 n, *l = map(int, open(0).read().split()) map(int, open(0).read().split()) n
from bisect import*
n, *l = map(int, open(0).read().split())
l.sort()
print(sum(max(0, bisect_left(l, l[i] + l[j]) - j - 1) for i in range(n) for j in range(i+1, n)))