import bisect

N = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        p = l[:i]
        a, b = l[i], l[j]
        low = b - a + 1
        high = a + b
        ans += bisect.bisect_left(p, high) - bisect.bisect_left(p, low)
print(ans) 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 l.sort() l.sort l sort ans = 0 ans 0 for i in range(N - 1):
    for j in range(i + 1, N):
        p = l[:i]
        a, b = l[i], l[j]
        low = b - a + 1
        high = a + b
        ans += bisect.bisect_left(p, high) - bisect.bisect_left(p, low) i range(N - 1) range N - 1 N 1 for j in range(i + 1, N):
        p = l[:i]
        a, b = l[i], l[j]
        low = b - a + 1
        high = a + b
        ans += bisect.bisect_left(p, high) - bisect.bisect_left(p, low) j range(i + 1, N) range i + 1 i 1 N p = l[:i] p l[:i] l :i i a, b = l[i], l[j] a l[i] l i b l[j] l j low = b - a + 1 low b - a + 1 b - a b a 1 high = a + b high a + b a b ans += bisect.bisect_left(p, high) - bisect.bisect_left(p, low) ans bisect.bisect_left(p, high) - bisect.bisect_left(p, low) bisect.bisect_left(p, high) bisect.bisect_left bisect bisect_left p high bisect.bisect_left(p, low) bisect.bisect_left bisect bisect_left p low print(ans) print ans low = b - a + 1 b - a + 1 low high = a + b a + b high l = list(map(int, input().split())) list(map(int, input().split())) l ans = 0 0 ans N = int(input()) int(input()) N a, b = l[i], l[j] l[i] a p = l[:i] l[:i] p ans += bisect.bisect_left(p, high) - bisect.bisect_left(p, low) bisect.bisect_left(p, high) - bisect.bisect_left(p, low) ans b = l[i], l[j] l[j] b
import bisect

N = int(input())
l = list(map(int, input().split()))
l.sort()
ans = 0
for i in range(N - 1):
    for j in range(i + 1, N):
        p = l[:i]
        a, b = l[i], l[j]
        low = b - a + 1
        high = a + b
        ans += bisect.bisect_left(p, high) - bisect.bisect_left(p, low)
print(ans)