n = int(input())
A = list(map(int, input().split()))
A = sorted(A)
ans = 0


def q(k):
    if A[k] < A[i] + A[j]:
        return True
    else:
        return False


for i in range(n):
    for j in range(i + 1, n):
        l = j
        r = n
        while r - l > 1:
            mid = (l + r) // 2
            if q(mid):
                l = mid
            else:
                r = mid
        ans += (l - j)


print(ans) n = int(input()) n int(input()) int input() input A = list(map(int, input().split())) A list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split A = sorted(A) A sorted(A) sorted A ans = 0 ans 0 def q(k):
    if A[k] < A[i] + A[j]:
        return True
    else:
        return False q if A[k] < A[i] + A[j]:
        return True
    else:
        return False A[k] < A[i] + A[j] A[k] A k A[i] + A[j] A[i] A i A[j] A j return True True return False False k k for i in range(n):
    for j in range(i + 1, n):
        l = j
        r = n
        while r - l > 1:
            mid = (l + r) // 2
            if q(mid):
                l = mid
            else:
                r = mid
        ans += (l - j) i range(n) range n for j in range(i + 1, n):
        l = j
        r = n
        while r - l > 1:
            mid = (l + r) // 2
            if q(mid):
                l = mid
            else:
                r = mid
        ans += (l - j) j range(i + 1, n) range i + 1 i 1 n l = j l j r = n r n while r - l > 1:
            mid = (l + r) // 2
            if q(mid):
                l = mid
            else:
                r = mid
         r - l > 1 r - l r l 1 mid = (l + r) // 2 mid (l + r) // 2 l + r l r 2 if q(mid):
                l = mid
            else:
                r = mid
         q(mid) q mid l = mid l mid r = mid r mid ans += (l - j) ans l - j l j print(ans) print ans r = n n r n = int(input()) int(input()) n A = sorted(A) sorted(A) A ans = 0 0 ans A = list(map(int, input().split())) list(map(int, input().split())) A ans += (l - j) l - j ans l = mid mid l r = mid mid r def q(k):
    if A[k] < A[i] + A[j]:
        return True
    else:
        return False def q(k):
    if A[k] < A[i] + A[j]:
        return True
    else:
        return False q l = j j l mid = (l + r) // 2 (l + r) // 2 mid
n = int(input())
A = list(map(int, input().split()))
A = sorted(A)
ans = 0


def q(k):
    if A[k] < A[i] + A[j]:
        return True
    else:
        return False


for i in range(n):
    for j in range(i + 1, n):
        l = j
        r = n
        while r - l > 1:
            mid = (l + r) // 2
            if q(mid):
                l = mid
            else:
                r = mid
        ans += (l - j)


print(ans)
