n = int(input())
L = list(map(int, input().split()))
L.sort()
count = 0
for i in range(n - 2):
  a = L[i]
  for j in range(i + 1, n - 1):
    b = L[j]
    l = j
    r = n
    while r - l > 1:
      p = (l + r) // 2
      if L[p] < a + b:
        l = p
      else:
        r = p
    count += l - j
print(count) 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 count = 0 count 0 for i in range(n - 2):
  a = L[i]
  for j in range(i + 1, n - 1):
    b = L[j]
    l = j
    r = n
    while r - l > 1:
      p = (l + r) // 2
      if L[p] < a + b:
        l = p
      else:
        r = p
    count += l - j i range(n - 2) range n - 2 n 2 a = L[i] a L[i] L i for j in range(i + 1, n - 1):
    b = L[j]
    l = j
    r = n
    while r - l > 1:
      p = (l + r) // 2
      if L[p] < a + b:
        l = p
      else:
        r = p
    count += l - j j range(i + 1, n - 1) range i + 1 i 1 n - 1 n 1 b = L[j] b L[j] L j l = j l j r = n r n while r - l > 1:
      p = (l + r) // 2
      if L[p] < a + b:
        l = p
      else:
        r = p
     r - l > 1 r - l r l 1 p = (l + r) // 2 p (l + r) // 2 l + r l r 2 if L[p] < a + b:
        l = p
      else:
        r = p
     L[p] < a + b L[p] L p a + b a b l = p l p r = p r p count += l - j count l - j l j print(count) print count l = j j l L = list(map(int, input().split())) list(map(int, input().split())) L p = (l + r) // 2 (l + r) // 2 p r = p p r a = L[i] L[i] a l = p p l count += l - j l - j count n = int(input()) int(input()) n b = L[j] L[j] b count = 0 0 count r = n n r
n = int(input())
L = list(map(int, input().split()))
L.sort()
count = 0
for i in range(n - 2):
  a = L[i]
  for j in range(i + 1, n - 1):
    b = L[j]
    l = j
    r = n
    while r - l > 1:
      p = (l + r) // 2
      if L[p] < a + b:
        l = p
      else:
        r = p
    count += l - j
print(count)
