from bisect import bisect_left
N=int(input())
A=sorted(list(map(int,input().split())))
cnt=0
for i in range(N-1):
    for j in range(i+1,N):
        a=bisect_left(A,A[i]+A[j])
        if j<a:
            cnt+=a-j-1
print(cnt) from bisect import bisect_left N=int(input()) N int(input()) int input() input A=sorted(list(map(int,input().split()))) A sorted(list(map(int,input().split()))) sorted list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split cnt=0 cnt 0 for i in range(N-1):
    for j in range(i+1,N):
        a=bisect_left(A,A[i]+A[j])
        if j<a:
            cnt+=a-j-1 i range(N-1) range N-1 N 1 for j in range(i+1,N):
        a=bisect_left(A,A[i]+A[j])
        if j<a:
            cnt+=a-j-1 j range(i+1,N) range i+1 i 1 N a=bisect_left(A,A[i]+A[j]) a bisect_left(A,A[i]+A[j]) bisect_left A A[i]+A[j] A[i] A i A[j] A j if j<a:
            cnt+=a-j-1 j<a j a cnt+=a-j-1 cnt a-j-1 a-j a j 1 print(cnt) print cnt a=bisect_left(A,A[i]+A[j]) bisect_left(A,A[i]+A[j]) a N=int(input()) int(input()) N A=sorted(list(map(int,input().split()))) sorted(list(map(int,input().split()))) A cnt=0 0 cnt cnt+=a-j-1 a-j-1 cnt
from bisect import bisect_left
N=int(input())
A=sorted(list(map(int,input().split())))
cnt=0
for i in range(N-1):
    for j in range(i+1,N):
        a=bisect_left(A,A[i]+A[j])
        if j<a:
            cnt+=a-j-1
print(cnt)