n = int(input())
l = list(map(int,input().split()))

import bisect
l.sort()
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        idx = bisect.bisect_left(l,l[i]+l[j])
        #print('idx',idx)
        if j < idx:
            cnt += idx - j - 1


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 import bisect bisect l.sort() l.sort l sort cnt = 0 cnt 0 for i in range(n):
    for j in range(i+1,n):
        idx = bisect.bisect_left(l,l[i]+l[j])
        #print('idx',idx)
        if j < idx:
            cnt += idx - j - 1 i range(n) range n for j in range(i+1,n):
        idx = bisect.bisect_left(l,l[i]+l[j])
        #print('idx',idx)
        if j < idx:
            cnt += idx - j - 1 j range(i+1,n) range i+1 i 1 n idx = bisect.bisect_left(l,l[i]+l[j]) idx bisect.bisect_left(l,l[i]+l[j]) bisect.bisect_left bisect bisect_left l l[i]+l[j] l[i] l i l[j] l j if j < idx:
            cnt += idx - j - 1 j < idx j idx cnt += idx - j - 1 cnt idx - j - 1 idx - j idx j 1 print(cnt) print cnt cnt += idx - j - 1 idx - j - 1 cnt idx = bisect.bisect_left(l,l[i]+l[j]) bisect.bisect_left(l,l[i]+l[j]) idx n = int(input()) int(input()) n l = list(map(int,input().split())) list(map(int,input().split())) l cnt = 0 0 cnt
n = int(input())
l = list(map(int,input().split()))

import bisect
l.sort()
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        idx = bisect.bisect_left(l,l[i]+l[j])
        #print('idx',idx)
        if j < idx:
            cnt += idx - j - 1


print(cnt)