n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        a = l[i]
        b = l[j]
        x = (a+1) - b
        y = (b+1) - a
        z = max(x,y)
        a = j+1
        b = n-1
        c = (a+b) // 2
        while a <= b:
            if l[c] == z:
                a += 1
            elif l[c] > z:
                a = c + 1
            elif l[c] < z:
                b = c - 1
            else:
                pass
            c = (a+b) // 2
        ans += c-j
print(ans) 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(reverse=True) l.sort l sort reverse=True reverse True ans = 0 ans 0 for i in range(n-2):
    for j in range(i+1,n-1):
        a = l[i]
        b = l[j]
        x = (a+1) - b
        y = (b+1) - a
        z = max(x,y)
        a = j+1
        b = n-1
        c = (a+b) // 2
        while a <= b:
            if l[c] == z:
                a += 1
            elif l[c] > z:
                a = c + 1
            elif l[c] < z:
                b = c - 1
            else:
                pass
            c = (a+b) // 2
        ans += c-j i range(n-2) range n-2 n 2 for j in range(i+1,n-1):
        a = l[i]
        b = l[j]
        x = (a+1) - b
        y = (b+1) - a
        z = max(x,y)
        a = j+1
        b = n-1
        c = (a+b) // 2
        while a <= b:
            if l[c] == z:
                a += 1
            elif l[c] > z:
                a = c + 1
            elif l[c] < z:
                b = c - 1
            else:
                pass
            c = (a+b) // 2
        ans += c-j j range(i+1,n-1) range i+1 i 1 n-1 n 1 a = l[i] a l[i] l i b = l[j] b l[j] l j x = (a+1) - b x (a+1) - b a+1 a 1 b y = (b+1) - a y (b+1) - a b+1 b 1 a z = max(x,y) z max(x,y) max x y a = j+1 a j+1 j 1 b = n-1 b n-1 n 1 c = (a+b) // 2 c (a+b) // 2 a+b a b 2 while a <= b:
            if l[c] == z:
                a += 1
            elif l[c] > z:
                a = c + 1
            elif l[c] < z:
                b = c - 1
            else:
                pass
            c = (a+b) // 2
         a <= b a b if l[c] == z:
                a += 1
            elif l[c] > z:
                a = c + 1
            elif l[c] < z:
                b = c - 1
            else:
                pass
             l[c] == z l[c] l c z a += 1 a 1 elif l[c] > z:
                a = c + 1
             l[c] > z l[c] l c z a = c + 1 a c + 1 c 1 elif l[c] < z:
                b = c - 1
             l[c] < z l[c] l c z b = c - 1 b c - 1 c 1 c = (a+b) // 2 c (a+b) // 2 a+b a b 2 ans += c-j ans c-j c j print(ans) print ans b = l[j] l[j] b ans = 0 0 ans a = j+1 j+1 a b = c - 1 c - 1 b c = (a+b) // 2 (a+b) // 2 c ans += c-j c-j ans c = (a+b) // 2 (a+b) // 2 c n = int(input()) int(input()) n a += 1 1 a b = n-1 n-1 b a = c + 1 c + 1 a x = (a+1) - b (a+1) - b x y = (b+1) - a (b+1) - a y z = max(x,y) max(x,y) z l = list(map(int,input().split())) list(map(int,input().split())) l a = l[i] l[i] a
n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        a = l[i]
        b = l[j]
        x = (a+1) - b
        y = (b+1) - a
        z = max(x,y)
        a = j+1
        b = n-1
        c = (a+b) // 2
        while a <= b:
            if l[c] == z:
                a += 1
            elif l[c] > z:
                a = c + 1
            elif l[c] < z:
                b = c - 1
            else:
                pass
            c = (a+b) // 2
        ans += c-j
print(ans)