def main():

    from bisect import bisect_right



    N = int(eval(input()))

    *e, = list(map(int, input().split()))



    e.sort()



    ans = 0

    for j in range(2, N):

        for i in range(1, j):

            d = e[j] - e[i]

            ans += i - bisect_right(e, d, lo=0, hi=i)



    print(ans)





if __name__ == '__main__':

    main()



# import sys

# input = sys.stdin.readline

# 

# sys.setrecursionlimit(10 ** 7)

# 

# (int(x)-1 for x in input().split())

# rstrip()

def main():

    from bisect import bisect_right



    N = int(eval(input()))

    *e, = list(map(int, input().split()))



    e.sort()



    ans = 0

    for j in range(2, N):

        for i in range(1, j):

            d = e[j] - e[i]

            ans += max(0, i - bisect_right(e, d))



    print(ans)





if __name__ == '__main__':

    main()



# import sys

# input = sys.stdin.readline

#

# sys.setrecursionlimit(10 ** 7)

#

# (int(x)-1 for x in input().split())

# rstrip()

def main():
    from bisect import bisect_right

    N = int(eval(input()))
    (*e,) = list(map(int, input().split()))
    e.sort()
    ans = 0
    for j in range(2, N):
        for i in range(1, j):
            d = e[j] - e[i]
            ans += i - bisect_right(e, d, lo=0, hi=i)
    print(ans)


if __name__ == "__main__":
    main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()

def main():
    from bisect import bisect_right

    N = int(eval(input()))
    (*e,) = list(map(int, input().split()))
    e.sort()
    ans = 0
    for j in range(2, N):
        for i in range(1, j):
            d = e[j] - e[i]
            ans += max(0, i - bisect_right(e, d))
    print(ans)


if __name__ == "__main__":
    main()
# import sys
# input = sys.stdin.readline
#
# sys.setrecursionlimit(10 ** 7)
#
# (int(x)-1 for x in input().split())
# rstrip()

-            ans += i - bisect_right(e, d, lo=0, hi=i) +            ans += max(0, i - bisect_right(e, d))