Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

pattern = int(input())

xs = []
ys = []
hs = []


for _ in range(pattern):
    x, y , h = map(int,input().split(' '))
    xs.append(x)
    ys.append(y)
    hs.append(h)

correct = 0

max_h = max(hs) + 120

for Cx in range(101):
    for Cy in range(101):
        for H in range(1, max_h):
            for x, y, h in zip(xs, ys, hs):
                if abs(x-Cx) + abs(y-Cy) == abs(h-H):
                    correct += 1
                    if correct == len(xs) and max(hs) <= H:
                        print(Cx, Cy, H)
                else:
                    correct = 0
                    continue

### FIXED CODE ###

N = int(input())

coords = [list(map(int, input().split(' '))) for _ in range(N)]

coords.sort(key=lambda x: x[2], reverse=True)

# 全探索
def search():
    for Cx in range(101):
        for Cy in range(101):
            x, y, h = tuple(coords[0])
            H = h + abs(Cx - x) + abs(Cy - y)
            for x, y, h in coords:
                if max(H - abs(Cx - x) - abs(Cy - y), 0) != h:
                    break
            else:
                return Cx, Cy, H

x, y, h = search()
print("{} {} {}".format(x, y, h))
### BUGGY CODE ###

N=int(input())
L_list = list(map(int,input().split()))

def binary_search_left(list,target):
    '''
    配列に対してある数nを配列のソート順を崩さないように挿入するためのindexを返す関数。
    同一の数が配列に複数含まれていた場合は最も小さいindexを返す。
    '''
    result = -1
    left = 0
    right = len(list) - 1

    while left <= right:
        center = (left + right)//2
        if list[center] == target:          # 一致した場合
            if list[center - 1] == target:  # -> その一つ前も一致した場合、rightをcenterにしてもう一周
                right = center
            else:                           # -> その一つ前は一致しない場合、一番左で一致したということでcenterを返す
                return center
        elif list[center] < target:
            left = center + 1
        elif list[center] > target:
            right = center - 1
    return left                             # 一致したらcenterを返すが（上記）、なければleftのインデックスを返す

L_list = sorted(L_list)

ans = 0
for a_index in range(0, N-2):
    for b_index in range(a_index+1, N-1):
        a = L_list[a_index]
        b = L_list[b_index]
        c_right_index = binary_search_left(L_list, a+b)
        if c_right_index > b_index:
            ans += c_right_index - b_index - 1
        else:
            pass

print(ans)

### FIXED CODE ###

N=int(input())
L_list = list(map(int,input().split()))

import bisect

L_list = sorted(L_list)
 
ans = 0
for a_index in range(0, N):
    for b_index in range(a_index+1, N):
        a = L_list[a_index]
        b = L_list[b_index]
        c_right_index = bisect.bisect_left(L_list, a+b)
        if c_right_index > b_index:
            ans += c_right_index - b_index - 1
        else:
            pass

print(ans)