N = int(input())
L = list(map(int,input().split()))
L.sort()
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        h_min = j
        h_max = N
        while h_max - h_min != 1:
            h_mid = (h_max + h_min) // 2
            if L[i] + L[j] > L[h_mid]:
                h_min = h_mid
            else:
                h_max = h_mid
        cnt += h_min - j
print(cnt) N = int(input()) N int(input()) int input() input L = list(map(int,input().split())) L list(map(int,input().split())) list map(int,input().split()) map int input().split() ().split () input split L.sort() L.sort L sort cnt = 0 cnt 0 for i in range(N-2):
    for j in range(i+1,N-1):
        h_min = j
        h_max = N
        while h_max - h_min != 1:
            h_mid = (h_max + h_min) // 2
            if L[i] + L[j] > L[h_mid]:
                h_min = h_mid
            else:
                h_max = h_mid
        cnt += h_min - j i range(N-2) range N-2 N 2 for j in range(i+1,N-1):
        h_min = j
        h_max = N
        while h_max - h_min != 1:
            h_mid = (h_max + h_min) // 2
            if L[i] + L[j] > L[h_mid]:
                h_min = h_mid
            else:
                h_max = h_mid
        cnt += h_min - j j range(i+1,N-1) range i+1 i 1 N-1 N 1 h_min = j h_min j h_max = N h_max N while h_max - h_min != 1:
            h_mid = (h_max + h_min) // 2
            if L[i] + L[j] > L[h_mid]:
                h_min = h_mid
            else:
                h_max = h_mid
         h_max - h_min != 1 h_max - h_min h_max h_min 1 h_mid = (h_max + h_min) // 2 h_mid (h_max + h_min) // 2 h_max + h_min h_max h_min 2 if L[i] + L[j] > L[h_mid]:
                h_min = h_mid
            else:
                h_max = h_mid
         L[i] + L[j] > L[h_mid] L[i] + L[j] L[i] L i L[j] L j L[h_mid] L h_mid h_min = h_mid h_min h_mid h_max = h_mid h_max h_mid cnt += h_min - j cnt h_min - j h_min j print(cnt) print cnt h_mid = (h_max + h_min) // 2 (h_max + h_min) // 2 h_mid L = list(map(int,input().split())) list(map(int,input().split())) L cnt = 0 0 cnt h_max = h_mid h_mid h_max cnt += h_min - j h_min - j cnt h_min = j j h_min h_max = N N h_max N = int(input()) int(input()) N h_min = h_mid h_mid h_min
N = int(input())
L = list(map(int,input().split()))
L.sort()
cnt = 0
for i in range(N-2):
    for j in range(i+1,N-1):
        h_min = j
        h_max = N
        while h_max - h_min != 1:
            h_mid = (h_max + h_min) // 2
            if L[i] + L[j] > L[h_mid]:
                h_min = h_mid
            else:
                h_max = h_mid
        cnt += h_min - j
print(cnt)