import itertools
import bisect
N = int(input())
L = list(map(int, input().split()))
ans = 0
LS = sorted(L)
l = len(LS)
for i in range(l):
  for j in range(l):
    if i < j:
      k = bisect.bisect_left(LS,LS[i]+LS[j])
      ans += k-j-1
print(ans) import itertools itertools import bisect bisect 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 ans = 0 ans 0 LS = sorted(L) LS sorted(L) sorted L l = len(LS) l len(LS) len LS for i in range(l):
  for j in range(l):
    if i < j:
      k = bisect.bisect_left(LS,LS[i]+LS[j])
      ans += k-j-1 i range(l) range l for j in range(l):
    if i < j:
      k = bisect.bisect_left(LS,LS[i]+LS[j])
      ans += k-j-1 j range(l) range l if i < j:
      k = bisect.bisect_left(LS,LS[i]+LS[j])
      ans += k-j-1 i < j i j k = bisect.bisect_left(LS,LS[i]+LS[j]) k bisect.bisect_left(LS,LS[i]+LS[j]) bisect.bisect_left bisect bisect_left LS LS[i]+LS[j] LS[i] LS i LS[j] LS j ans += k-j-1 ans k-j-1 k-j k j 1 print(ans) print ans l = len(LS) len(LS) l ans = 0 0 ans N = int(input()) int(input()) N k = bisect.bisect_left(LS,LS[i]+LS[j]) bisect.bisect_left(LS,LS[i]+LS[j]) k ans += k-j-1 k-j-1 ans LS = sorted(L) sorted(L) LS L = list(map(int, input().split())) list(map(int, input().split())) L
import itertools
import bisect
N = int(input())
L = list(map(int, input().split()))
ans = 0
LS = sorted(L)
l = len(LS)
for i in range(l):
  for j in range(l):
    if i < j:
      k = bisect.bisect_left(LS,LS[i]+LS[j])
      ans += k-j-1
print(ans)
