n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
import bisect
for i in range(n-2):
    for j in range(i+1, n-1):
        ab = l[i]+l[j]
        idx = bisect.bisect_left(l, ab)
        ans += max(0, idx-j-1)
print(ans) n = int(input()) n int(input()) int input() input l = sorted(list(map(int, input().split()))) l sorted(list(map(int, input().split()))) sorted list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split ans = 0 ans 0 import bisect bisect for i in range(n-2):
    for j in range(i+1, n-1):
        ab = l[i]+l[j]
        idx = bisect.bisect_left(l, ab)
        ans += max(0, idx-j-1) i range(n-2) range n-2 n 2 for j in range(i+1, n-1):
        ab = l[i]+l[j]
        idx = bisect.bisect_left(l, ab)
        ans += max(0, idx-j-1) j range(i+1, n-1) range i+1 i 1 n-1 n 1 ab = l[i]+l[j] ab l[i]+l[j] l[i] l i l[j] l j idx = bisect.bisect_left(l, ab) idx bisect.bisect_left(l, ab) bisect.bisect_left bisect bisect_left l ab ans += max(0, idx-j-1) ans max(0, idx-j-1) max 0 idx-j-1 idx-j idx j 1 print(ans) print ans ans = 0 0 ans n = int(input()) int(input()) n l = sorted(list(map(int, input().split()))) sorted(list(map(int, input().split()))) l ab = l[i]+l[j] l[i]+l[j] ab idx = bisect.bisect_left(l, ab) bisect.bisect_left(l, ab) idx ans += max(0, idx-j-1) max(0, idx-j-1) ans
n = int(input())
l = sorted(list(map(int, input().split())))
ans = 0
import bisect
for i in range(n-2):
    for j in range(i+1, n-1):
        ab = l[i]+l[j]
        idx = bisect.bisect_left(l, ab)
        ans += max(0, idx-j-1)
print(ans)