import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    l = LI()
    l.sort()
    ans = 0

    for i in range(n):
        for j in range(i):
            mini = l[i] - l[j]
            if mini < l[j]:
                ans += n-bisect.bisect_right(l, mini) - (n-j)

    print(ans)

main() import bisect,collections,copy,itertools,math,string bisect collections copy itertools math string import sys sys def I(): return int(sys.stdin.readline().rstrip()) I def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI def S(): return sys.stdin.readline().rstrip() S def LS(): return list(sys.stdin.readline().rstrip().split()) LS def main():
    n = I()
    l = LI()
    l.sort()
    ans = 0

    for i in range(n):
        for j in range(i):
            mini = l[i] - l[j]
            if mini < l[j]:
                ans += n-bisect.bisect_right(l, mini) - (n-j)

    print(ans) main n = I() n I() I l = LI() l LI() LI l.sort() l.sort l sort ans = 0 ans 0 for i in range(n):
        for j in range(i):
            mini = l[i] - l[j]
            if mini < l[j]:
                ans += n-bisect.bisect_right(l, mini) - (n-j)

     i range(n) range n for j in range(i):
            mini = l[i] - l[j]
            if mini < l[j]:
                ans += n-bisect.bisect_right(l, mini) - (n-j)

     j range(i) range i mini = l[i] - l[j] mini l[i] - l[j] l[i] l i l[j] l j if mini < l[j]:
                ans += n-bisect.bisect_right(l, mini) - (n-j)

     mini < l[j] mini l[j] l j ans += n-bisect.bisect_right(l, mini) - (n-j) ans n-bisect.bisect_right(l, mini) - (n-j) n-bisect.bisect_right(l, mini) n bisect.bisect_right(l, mini) bisect.bisect_right bisect bisect_right l mini n-j n j print(ans) print ans main() main def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) def LI(): return list(map(int,sys.stdin.readline().rstrip().split())) LI def LS(): return list(sys.stdin.readline().rstrip().split()) def LS(): return list(sys.stdin.readline().rstrip().split()) LS def main():
    n = I()
    l = LI()
    l.sort()
    ans = 0

    for i in range(n):
        for j in range(i):
            mini = l[i] - l[j]
            if mini < l[j]:
                ans += n-bisect.bisect_right(l, mini) - (n-j)

    print(ans) def main():
    n = I()
    l = LI()
    l.sort()
    ans = 0

    for i in range(n):
        for j in range(i):
            mini = l[i] - l[j]
            if mini < l[j]:
                ans += n-bisect.bisect_right(l, mini) - (n-j)

    print(ans) main def I(): return int(sys.stdin.readline().rstrip()) def I(): return int(sys.stdin.readline().rstrip()) I def S(): return sys.stdin.readline().rstrip() def S(): return sys.stdin.readline().rstrip() S
import bisect,collections,copy,itertools,math,string
import sys
def I(): return int(sys.stdin.readline().rstrip())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))
def S(): return sys.stdin.readline().rstrip()
def LS(): return list(sys.stdin.readline().rstrip().split())
def main():
    n = I()
    l = LI()
    l.sort()
    ans = 0

    for i in range(n):
        for j in range(i):
            mini = l[i] - l[j]
            if mini < l[j]:
                ans += n-bisect.bisect_right(l, mini) - (n-j)

    print(ans)

main()
