n = int(input())
ls = list(map(int, input().split()))
rsw = [0]*1005
for i in ls:
    rsw[i] += 1
for i in range(1,1005):
    rsw[i] = rsw[i-1] + rsw[i]
res = 0
for i in range(n):
    for j in range(i+1,n):
        a = ls[i]
        b = ls[j]
        low = abs(a-b)
        high = a+b
        tmp = rsw[min(high,1004)-1] - rsw[low]
        if low < a < high:
            tmp -= 1
        if low < b < high:
            tmp -= 1
        res += tmp
print(res//3) n = int(input()) n int(input()) int input() input ls = list(map(int, input().split())) ls list(map(int, input().split())) list map(int, input().split()) map int input().split() ().split () input split rsw = [0]*1005 rsw [0]*1005 [0] 0 1005 for i in ls:
    rsw[i] += 1 i ls rsw[i] += 1 rsw[i] rsw i 1 for i in range(1,1005):
    rsw[i] = rsw[i-1] + rsw[i] i range(1,1005) range 1 1005 rsw[i] = rsw[i-1] + rsw[i] rsw[i] rsw i rsw[i-1] + rsw[i] rsw[i-1] rsw i-1 i 1 rsw[i] rsw i res = 0 res 0 for i in range(n):
    for j in range(i+1,n):
        a = ls[i]
        b = ls[j]
        low = abs(a-b)
        high = a+b
        tmp = rsw[min(high,1004)-1] - rsw[low]
        if low < a < high:
            tmp -= 1
        if low < b < high:
            tmp -= 1
        res += tmp i range(n) range n for j in range(i+1,n):
        a = ls[i]
        b = ls[j]
        low = abs(a-b)
        high = a+b
        tmp = rsw[min(high,1004)-1] - rsw[low]
        if low < a < high:
            tmp -= 1
        if low < b < high:
            tmp -= 1
        res += tmp j range(i+1,n) range i+1 i 1 n a = ls[i] a ls[i] ls i b = ls[j] b ls[j] ls j low = abs(a-b) low abs(a-b) abs a-b a b high = a+b high a+b a b tmp = rsw[min(high,1004)-1] - rsw[low] tmp rsw[min(high,1004)-1] - rsw[low] rsw[min(high,1004)-1] rsw min(high,1004)-1 min(high,1004) min high 1004 1 rsw[low] rsw low if low < a < high:
            tmp -= 1
         low < a < high low < a low a high tmp -= 1 tmp 1 if low < b < high:
            tmp -= 1
         low < b < high low < b low b high tmp -= 1 tmp 1 res += tmp res tmp print(res//3) print res//3 res 3 a = ls[i] ls[i] a rsw = [0]*1005 [0]*1005 rsw high = a+b a+b high tmp = rsw[min(high,1004)-1] - rsw[low] rsw[min(high,1004)-1] - rsw[low] tmp res += tmp tmp res ls = list(map(int, input().split())) list(map(int, input().split())) ls n = int(input()) int(input()) n res = 0 0 res low = abs(a-b) abs(a-b) low tmp -= 1 1 tmp b = ls[j] ls[j] b tmp -= 1 1 tmp
n = int(input())
ls = list(map(int, input().split()))
rsw = [0]*1005
for i in ls:
    rsw[i] += 1
for i in range(1,1005):
    rsw[i] = rsw[i-1] + rsw[i]
res = 0
for i in range(n):
    for j in range(i+1,n):
        a = ls[i]
        b = ls[j]
        low = abs(a-b)
        high = a+b
        tmp = rsw[min(high,1004)-1] - rsw[low]
        if low < a < high:
            tmp -= 1
        if low < b < high:
            tmp -= 1
        res += tmp
print(res//3)