from bisect import bisect_left
n, *l = map(int, open(0).read().split())
l.sort()

print(sum(bisect_left(l, l[i] + l[j]) - 1 - j for i in range(n)
          for j in range(i + 1, n))) from bisect import bisect_left 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(bisect_left(l, l[i] + l[j]) - 1 - j for i in range(n)
          for j in range(i + 1, n))) print sum(bisect_left(l, l[i] + l[j]) - 1 - j for i in range(n)
          for j in range(i + 1, n)) sum bisect_left(l, l[i] + l[j]) - 1 - j bisect_left(l, l[i] + l[j]) - 1 bisect_left(l, l[i] + l[j]) bisect_left l l[i] + l[j] l[i] l i l[j] l j 1 j n, *l = map(int, open(0).read().split()) map(int, open(0).read().split()) n
from bisect import bisect_left
n, *l = map(int, open(0).read().split())
l.sort()

print(sum(bisect_left(l, l[i] + l[j]) - 1 - j for i in range(n)
          for j in range(i + 1, n)))
