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

def myinput(rownum):
    res = []
    for i in range(rownum):
        temp = input().split(" ")
        res += temp
    return res


def main():
    r = myinput(2)
    n = r[0]
    a = list(map(lambda x:int(x),r[1:]))
    res = ""
    res = [str(a.index(i+1) + 1) for i in range(len(a))]
    print(" ".join(res))

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
#input = sys.stdin.readline

def main():
    n = input()
    a = input().split(" ")
    # r = ""
    # for i in range(int(n)):
    #     r += str(a.index(str(i+1)) + 1) + " "
    # print(r[:-1])
    a = [(a[i],str(i+1)) for i in range(len(a))]
    a = list(map(lambda x:x[1],sorted(a,key=lambda x:int(x[0]))))
    print(" ".join(a))

if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

d=0
ans=[0]*N
while len(A)>1:
  for i in reversed(range((len(A)+1)//2,len(A))):
    asum=A[i]
    for j in range(len(A)+1,N+1):
      if j%(i+1)==0:
        asum+=ans[j-1]
    if asum%2==1:
      ans[i]=1
    A.pop(i)

if A[0]+sum(ans)%2==1:
  ans[0]=1
  
print(sum(ans))
_ans=[]
for i,e in enumerate(ans):
  if e==1:
    _ans.append(str(i+1))
print(" ".join(_ans))


### FIXED CODE ###

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

ans=[]
box=[0]*N

for i in reversed(range(1,N+1)):
  asum=sum(box[i-1::i])
  if asum%2+A[i-1]==1:
    box[i-1]=1
    ans.append(i)

print(len(ans))
print(*ans)
### BUGGY CODE ###

from functools import lru_cache
import sys 
sys.setrecursionlimit(2147483647)

N = int(input())
A = [list(map(int, input().split())) for i in range(N)]

#@lru_cache(None)
def dfs(d,pre):
    if (d,pre) in dic: return dic[(d,pre)]
    if d>=N - 1:
        dic[(d,pre)] = 0 
        return 0
    ma = 0 
    for idx,a in enumerate(A[d]):
        if idx != pre:
            res = dfs(d + 1,idx) + a 
            ma = max(res,ma)
    dic[(d,pre)] = ma
    return dic[(d,pre)]
dic = {}
res = dfs(-1,-1)
print(res)

### FIXED CODE ###

N = int(input())
A = []
for i in range(0,N):
    A.append(list(map(int,input().split())))

dp = [[0 for _ in range(3)] for _ in range(N)]
for i in range(N):
    for j in range(3):
        if i == 0:
            dp[i][j]= A[i][j]
        else:
            tmp = [0] 
            for k in range(3):
                if j !=k:
                    tmp.append(dp[i-1][k])
            dp[i][j] = max(tmp) + A[i][j]
print(max(dp[-1]))
### BUGGY CODE ###

tmp = input().split()
N = int(tmp[0])
K = int(tmp[1])
Q = int(tmp[2])

ns = []
for n in range(N):
    ns.append(K)

# print(ns)

for i in range(Q):
    a = input()
    a = int(a)-1

    for n in range(N):
        if n == a:
            continue
        else:
            ns[n] = ns[n]-1
    # print(ns)

for n in ns:
    if n > 0:
        print("Yes")
    else:
        print("No")

### FIXED CODE ###

tmp = input().split()
N = int(tmp[0])
K = int(tmp[1])
Q = int(tmp[2])

ns = []
for n in range(N):
    ns.append(K-Q)

# print(ns)

for i in range(Q):
    a = input()
    a = int(a)-1
    ns[a] = ns[a]+1
    # print(ns)

for n in ns:
    if n > 0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *


def solve(H: int, W: int, A: "List[str]"):
    queue = deque()

    rem = H * W
    for i in range(H):
        for j in range(W):
            if A[i][j] == '#':
                queue.append((i, j, 0))

    ret = 0
    visited = [False] * (W * H)
    while 0 < len(queue) and 0 < rem:
        i, j, n = queue.popleft()
        k = i * W + j
        if visited[k]:
            continue
        visited[k] = True
        ret = n
        rem -= 1

        if 0 < j and not visited[k - 1]:
            queue.append((i, j - 1, n + 1))
        if j < (W - 1) and not visited[k + 1]:
            queue.append((i, j + 1, n + 1))
        if 0 < i and not visited[k - W]:
            queue.append((i - 1, j, n + 1))
        if i < (H - 1) and not visited[k + W]:
            queue.append((i + 1, j, n + 1))
    return ret


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    A = [ next(tokens) for _ in range(H) ]  # type: "List[str]"
    result = solve(H, W, A)
    print(result)

if __name__ == '__main__':
    main()

### FIXED CODE ###

#!/usr/bin/env python3
import sys
from math import *
from itertools import *
from collections import *
from functools import *
from operator import *


def solve(H: int, W: int, A: "List[str]"):
    queue = deque()

    rem = H * W
    visited = [True] * ((W+2) * (H+2))
    for i in range(W+2):
        visited[i] = False
        visited[(W + 2) * (H + 1) + i] = False
    for i in range(H+2):
        visited[(W + 2) * i] = False
        visited[(W + 2) * i + (W + 1)] = False

    for i in range(H):
        l = A[i]
        for j in range(W):
            if l[j] == '#':
                queue.append((i+1, j+1, 0))
                k = i * (W + 2) + j
                visited[k] = False

    ret = 0
    while queue:
        i, j, n = queue.popleft()
        k = i * (W + 2) + j
        if not visited[k] and 0 < n:
            continue
        visited[k] = False
        ret = n
        rem -= 1

        if rem == 0:
            break

        if visited[k - 1]:
            queue.append((i, j - 1, n + 1))
        if visited[k + 1]:
            queue.append((i, j + 1, n + 1))

        if visited[k - (W + 2)]:
            queue.append((i - 1, j, n + 1))
        if visited[k + (W + 2)]:
            queue.append((i + 1, j, n + 1))
    return ret


def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    H = int(next(tokens))  # type: int
    W = int(next(tokens))  # type: int
    A = [ next(tokens) for _ in range(H) ]  # type: "List[str]"
    result = solve(H, W, A)
    print(result)

if __name__ == '__main__':
    main()
### BUGGY CODE ###

K, S = map(int, input().split())

cnt = 0
K += 1

for x in range(K):
    for y in range(K):
        for z in range(K):
            if x + y + z == S:
                cnt += 1

print(cnt)

### FIXED CODE ###

K, S = map(int, input().split())

cnt = 0
K += 1

#TLE CODE
'''
for x in range(K):
    for y in range(K):
        for z in range(K):
            if x + y + z == S:
                cnt += 1
'''

for x in range(K):
    for y in range(K):
        if 0 <= (S - (x + y)) < K:
            cnt += 1

print(cnt)
### BUGGY CODE ###

import sys
from collections import defaultdict
def input():
	return sys.stdin.readline()[:-1]
n, l = map(int, input().split())
ss = [input() for _ in range(n)]
#prefix = set()
#out = dict()
child = defaultdict(int)
for s in ss:
	u = ""
	for i in range(len(s)):
		child[u] |= int(s[i]) + 1
		u += s[i]

grundy = 0
for k, v in child.items():
	#print(k, v)
	le = len(k)
	if v == 1 or v == 2:
		grundy ^= (l-le) & (-l+le)

if grundy == 0:
	print("Bob")
else:
	print("Alice")


### FIXED CODE ###

import sys
#from collections import defaultdict
sys.setrecursionlimit(10**6)

def input():
	return sys.stdin.readline()[:-1]
n, l = map(int, input().split())
ss = [list(input())[::-1] for _ in range(n)]

def addTree(tree, sentence):
	if not sentence:
		return None   

	if sentence[-1] not in tree:
		tree[sentence[-1]] = {}

	p = sentence.pop()
	tree[p] = addTree(tree[p], sentence)

	return tree

def createTree(sentences):    
	tree = {}
	for sentence in sentences:
		tree = addTree(tree, sentence)

	return tree

tree = createTree(ss)
#print(tree)

grundy = 0
def dfs(cur, level):
	global grundy
	if cur is None:
		return
	elif len(cur) == 1:
		grundy ^= (l-level) & (-l+level)
	for k in cur.keys():
		dfs(cur[k], level+1)
	return
	
dfs(tree, 0)

if grundy == 0:
	print("Bob")
else:
	print("Alice")
### BUGGY CODE ###

S = input() 
Q = int(input())
process_list = [input().split() for i in range(Q)]  #[ [2, 1, p], [1], [2, 2, c], [1] ]

for lists in process_list:
    if lists[0] == "1":
        S = S[::-1]
    elif lists[0] == "2":
        if lists[1] == "1":
            S = lists[2] + S
        elif lists[1] == "2":
            S = S + lists[2]

print(S)

### FIXED CODE ###

S = input() 
Q = int(input())
rlist, llist = [], []
flag, cnt = 0, 0

def trans(f):
    if f == 1:
        f = 0
    elif f == 0:
        f = 1
    return f

def pros(f, r, add):
    if f == 0:
        if r == "1":
            llist.append(lists[2])
        elif r == "2":
            rlist.append(lists[2])
    elif f == 1:
        if r == "2":
            llist.append(lists[2])
        elif r == "1":
            rlist.append(lists[2])

for i in range(Q):
    lists = input().split()
    if lists[0] == "1":
        flag = trans(flag)
        cnt += 1
    else:
        pros(flag, lists[1], lists[2])
        
llist.reverse()
        
S = "".join(llist) + S + "".join(rlist)

if cnt % 2 == 1:
    S = S[::-1]
print(S)
### BUGGY CODE ###

from functools import reduce
from operator import mul

n = int(input())
a = list(map(int, input().split()))

ans = reduce(mul,a)

if ans > 10 ** 18:
  print(-1)

else:
  print(ans)



### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a.sort(reverse=True)

ans = 1

if all([i > 0 for i in a]):
  for i in range(n):
    ans *= a[i]
    if ans > 10 ** 18:
      ans = -1
      break

  print(ans)

else:
  print(0)
### BUGGY CODE ###

N=int(input())
dist=[list(map(int,input().split())) for i in range(N)]
ans=sum([sum(dist[i]) for i in range(N)])
ans//=2
for i in range(N):
    for j in range(i+1,N):
        for k in range(j+1,N):
            a,b,c=dist[i][j],dist[i][k],dist[j][k]
            if sum([a,b,c])/2==max(a,b,c):
                ans-=max(a,b,c)
            elif sum([a,b,c])/2<max(a,b,c):
                ans=-1*float('inf')
if ans<0:ans=-1
print(ans)

### FIXED CODE ###

import sys
input=sys.stdin.readline
N=int(input())
dist=[list(map(int,input().split())) for i in range(N)]
ans=sum([sum(dist[i]) for i in range(N)])
for i in range(N):
    dist[i][i]=float('inf')
ans//=2
def main(ans):
    for i in range(N):
        for j in range(i+1,N):
            Min=min(map(sum,zip(dist[i],dist[j])))
            if Min<dist[i][j]:
                return -1
            if Min==dist[i][j]:
                ans-=dist[i][j] 
    return ans
print(main(ans))
### BUGGY CODE ###

a, b, k = map(int, input().split())
x = []
for i in range(a, b+1):
    x.append(i)
lx = len(x)
if k < lx/2:
    for i in range(k):
        print(x[i])
    for i in range(lx-k, lx):
        print(x[i])
else:
    for i in x:
        print(i)


### FIXED CODE ###

a, b, k = map(int, input().split())
x = []
lx = b-a+1
if k <= lx//2:
    for i in range(a, a+k):
        print(i)
    for i in range(b-k+1, b+1):
        print(i)
else:
    for i in range(a, b+1):
        print(i)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
adj = [[] for _ in range(n)]
parity = [-1 for _ in range(n)]
valid = True

def dfs(x):
	global valid
	p = parity[x]
	for v in adj[x]:
		if parity[v] < 0:
			parity[v] = 1^p
			dfs(v)
		elif parity[v] == p:
			valid = False
			return
	return

for _ in range(m):
	a, b = map(int, input().split())
	adj[a-1].append(b-1)
	adj[b-1].append(a-1)

parity[0] = 0
dfs(0)
if not valid:
	print((n*(n-1)//2) - m)
else:
	o = sum(parity)
	print(o*(n-o) - m)

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**6)

n, m = map(int, input().split())
adj = [[] for _ in range(n)]
parity = [-1 for _ in range(n)]
valid = True

def dfs(x):
	global valid
	p = parity[x]
	for v in adj[x]:
		if parity[v] < 0:
			parity[v] = 1^p
			dfs(v)
		elif parity[v] == p:
			valid = False
			return
	return

for _ in range(m):
	a, b = map(int, input().split())
	adj[a-1].append(b-1)
	adj[b-1].append(a-1)

parity[0] = 0
dfs(0)
if not valid:
	print((n*(n-1)//2) - m)
else:
	o = sum(parity)
	print((n*(n-1)//2) - m - (o*(o-1)//2) - ((n-o)*(n-o-1)//2))
### BUGGY CODE ###

k, s = map(int, input().split())
ans = 0
for i in range(k+1):
    for j in range(k+1):
        for m in range(k+1):
            if i+j+m==s:
                ans += 1
                
print(ans)

### FIXED CODE ###

k, s = map(int, input().split())
ans = 0
for i in range(k+1):
    for j in range(k+1):
        if s-i-j <= k and 0<=s-i-j:
            ans += 1
        
print(ans)
### BUGGY CODE ###

N,K=map(int,input().split())
S=list(input())
MIN=min(S)

def minimum(S):
    T=S+S[::-1]

    ANS=[]

    for i in range(N+1):
        ANS.append(T[i:i+N])

    return min(ANS)

def next(S):
    T=S+S[::-1]
    LIST=[]
    CL=[0]*2*N
    count=0

    for i in range(2*N):
        if T[i]==MIN:
            count+=1

        else:
            count=0

        CL[i]=count

    MAX=max(CL)
    LIST=[]

    for i in range(N-1,2*N):
        if CL[i]==MAX:
            LIST.append(T[i+1-N:i+1])

    return LIST

if K==1:
    print("".join(minimum(S)))

else:
    CAN=next(S)

    ANS=[]

    for c in CAN:
        for j in range(K-2):
            c=next(c)[0]

            if c==MIN*N:
                print("".join(c))
                sys.exit()

        ANS.append(minimum(c))

    print("".join(min(ANS)))

### FIXED CODE ###

import sys

N,K=map(int,input().split())
S=list(input())
MIN=min(S)

def minimum(S):
    T=S+S[::-1]

    ANS=[]

    for i in range(N+1):
        ANS.append(T[i:i+N])

    return min(ANS)

def next(S):
    T=S+S[::-1]
    LIST=[]
    CL=[0]*2*N
    count=0

    for i in range(2*N):
        if T[i]==MIN:
            count+=1

        else:
            count=0

        CL[i]=count

    MAX=max(CL)
    LIST=[]

    for i in range(N-1,2*N):
        if CL[i]==MAX:
            LIST.append(T[i+1-N:i+1])

    return LIST,MAX

def next2(S,x):
    return [MIN]*x+S[x:][::-1]

if K==1:
    print("".join(minimum(S)))

else:
    CAN,MAX=next(S)

    if (MAX<<(K-1))>=N:
        print(MIN*N)
        sys.exit()

    ANS=[]

    for c in CAN:

        ANS.append(next2(c,MAX*((1<<(K-1))-1)))

    print("".join(min(ANS)))
### BUGGY CODE ###

n = int(input())
a = list(map(int, input(). split(' ')))
for i in range(1, n+1):
  x = a.count(i)
  print(x)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
l = []
for i in range(N):
    l.append(0)
for x in A:
    l[x-1] += 1
for s in l:
    print(s)
### BUGGY CODE ###

n,m,k=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
b=[int(x) for x in input().rstrip().split()]

A=[0]
B=[0]

for i in range(n):
  A.append(A[i]+a[i])

for i in range(m):
  B.append(B[i]+b[i])

ans=0
j=0

for i in range(n+1):
  j=0
  if A[i]>k:
    break
  nokori=k-A[i]

  while(B[j]<=nokori and j<m):
    j+=1

  if nokori<B[j]:
    j-=1
    
  ans=max(ans,i+j)
print(ans)


### FIXED CODE ###

n,m,k=[int(x) for x in input().rstrip().split()]
a=[int(x) for x in input().rstrip().split()]
b=[int(x) for x in input().rstrip().split()]

A=[0]
B=[0]

for i in range(n):
  A.append(A[i]+a[i])

for i in range(m):
  B.append(B[i]+b[i])

ans=0
j=m

for i in range(n+1):
  # j=m
  if A[i]>k:
    break
  nokori=k-A[i]

  while(nokori<B[j] and 0<=j):
    j-=1

    
  ans=max(ans,i+j)
print(ans)
### BUGGY CODE ###

n, k = map(int, input().split())
while n !=0 and n >= k:
  n = abs(n-k)
if n <= abs(n-k):
  print(n)
else:
  print(abs(n-k))

### FIXED CODE ###

n, k = map(int, input().split())
n = n%k
if n <= abs(n-k):
  print(n)
else:
  print(abs(n-k))
### BUGGY CODE ###

n = int(input())
s = [input() for i in range(n)]
ans = 0

ss = ['']*n
for i in range(n):
    ss[i] = sorted(s[i])

for i in range(n-1):
    for v in range(i+1,n):
        if ss[i] == ss[v]:
            ans += 1

print(ans)

### FIXED CODE ###

n = int(input())
s = [input() for i in range(n)]

# ソートしたsリスト作成（ss）
ss = ['']*n
for i in range(n):
    ss[i] = ''.join(sorted(s[i]))
    
# ssのsetを作成して重複要素削除(sss)
sss = list(set(ss))

# sssから辞書作成
dict_ss = {}
for i in range(len(sss)):
    dict_ss[sss[i]] = 0

# ssにおいて「sssの要素に合致する要素」の検索＆個数計上
for i in range(n):
    dict_ss[ss[i]] += 1

# 計上した個数のリストを作成
# その個数から2個の組み合わせを計算（n C 2）、足し合わせてans
ans_l = [dict_ss[sss[i]] for i in range(len(sss))]
ans = 0
for i in range(len(ans_l)):
    ans += (ans_l[i]*(ans_l[i]-1))/2

print(int(ans))
### BUGGY CODE ###

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

ab = []
for ax in a:
    for bx in b:
        ab.append(ax+bx)
ab = list(reversed(sorted(ab)))

abc = []
for i in range(min(k, len(ab))):
    abx = ab[i]
    for cx in c:
        abc.append(abx + cx)

abc = list(reversed(sorted(abc)))

for i in range(k):
    print(abc[i])


### FIXED CODE ###

x,y,z,k = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
c = list(map(int,input().split()))

a = list(reversed(sorted(a)))
b = list(reversed(sorted(b)))
c = list(reversed(sorted(c)))

abc = []
for p in range(x):
    for q in range(y):
        if (p+1) * (q+1) > k:
            break
        for r in range(z):
            if (p+1) * (q+1) * (r+1) > k:
                break
            abc.append(a[p]+ b[q] + c[r])

abc = list(reversed(sorted(abc)))

for i in range(k):
    print(abc[i])
### BUGGY CODE ###

import sys

def len_lcs(s1, s2):
    """Find length of the longest common sequence(LCS) of strings s1 and s2.
    The complexity is ~MN.

    >>> len_lcs("abc", "abc")
    3
    >>> len_lcs("abcbdaba", "bdcaba")
    5
    """
    len1 = len(s1)
    len2 = len(s2)
    if len1 == 0 or len2 == 0:
        return 0

    primary = [0] * len1
    secondary = [0] * len1

    for i in range(len2):
        for j in range(len1):
            if s1[j] == s2[i]:
                match = 1
            else:
                match = 0
            if j == 0:
                if primary[j] > match:
                    secondary[j] = primary[j]
                else:
                    secondary[j] = match
            else:
                sc1, p1, p2 = secondary[j-1], primary[j-1] + match, primary[j]
                if sc1 > p1:
                    if p1 > p2:
                        secondary[j] = sc1
                    elif p2 > sc1:
                        secondary[j] = p2
                    else:
                        secondary[j] = sc1
                else:
                    if sc1 > p2:
                        secondary[j] = p1
                    elif p1 > p2:
                        secondary[j] = p1
                    else:
                        secondary[j] = p2
                # secondary[j] = max(secondary[j-1], primary[j],
                #                    primary[j-1] + match)

        primary, secondary = secondary, primary

    return primary[len1-1]


def run():
    input()
    s = []
    for line in sys.stdin:
        s.append(line.strip())
    for i in range(0, len(s), 2):
        print(len_lcs(s[i], s[i+1]))


if __name__ == '__main__':
    run()



### FIXED CODE ###

import sys


def len_lcs(s1, s2):
    """Find length of the longest common sequence(LCS) of strings s1 and s2.
    The complexity is ~MN.

    >>> len_lcs("abc", "abc")
    3
    >>> len_lcs("abcbdaba", "bdcaba")
    5
    """
    results = [0] * len(s1)

    for i, c2 in enumerate(s2):
        sec1, pr1 = 0, 0
        for j, c1 in enumerate(s1):
            pr2 = results[j]
            if c1 == c2:
                mval = pr1 + 1
            elif sec1 > pr2:
                mval = sec1
            else:
                mval = pr2

            results[j] = mval
            sec1, pr1 = mval, pr2

    return results[-1]


def run():
    n = int(input())
    s = []
    for line in sys.stdin:
        s.append(line.strip())
    for i in range(0, 2*n, 2):
        print(len_lcs(s[i], s[i+1]))

run()
### BUGGY CODE ###

import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]
A = [int(input()) for _ in range(M)]
s = 1
s_ = 0
for n in range(1, N+1):
  if n in A:
    s, s_ = 0, s
    continue
  s, s_ = s + s_, s
print(s % (10 ** 9 + 7))


### FIXED CODE ###

import sys
input = sys.stdin.readline
N, M = [int(x) for x in input().strip().split()]
A = set([int(input()) for _ in range(M)])
s = [0 for _ in range(N + 1)]
s[0] = 1
if 1 not in A:
  s[1] = 1

for n in range(2, N+1):
  if n in A:
    continue
  else:
    s[n] = s[n-1] + s[n-2]
print(s[-1] % (10 ** 9 + 7))
### BUGGY CODE ###

import logging
import copy

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    S = input()
    S_len = len(S)
    child = [1 for _ in range(S_len)]
    logging.info("Hello!")

    for i in range(10000):
        diff_child = [0 for _ in range(S_len)]
        for j in range(S_len):
            if S[j] == "R":
                diff_child[j + 1] += child[j]
                child[j] = 0
            elif S[j] == "L":
                diff_child[j - 1] += child[j]
                child[j] = 0

        child = copy.copy(diff_child)
               

    answer = ""
    for x in child:
        answer += str(x)
        answer += " "

    print(answer)
        
    
if __name__ == "__main__":
    main()


### FIXED CODE ###

import logging
import copy

logging.basicConfig(level=logging.INFO, format="%(message)s")
#logging.disable(logging.CRITICAL)

def main():
    S = input()
    S_len = len(S)
    child = [1 for _ in range(S_len)]
    logging.info("Hello!")

    R_counter = 1
    L_counter = 0
    R = [0 for _ in range(S_len)]
    L = [0 for _ in range(S_len)]
    L2R = 0
    R2L = 0
    
    for i in range(1, S_len):
        if S[i] == "R" and S[i - 1] == "R":
            R_counter += 1
        elif S[i] == "L" and S[i - 1] == "R":
            R2L = i
            R[i - 1] = R_counter
            R_counter = 0
            L_counter += 1
        elif S[i] == "L" and S[i - 1] == "L":
            L_counter += 1
        elif S[i] == "R" and S[i - 1] == "L":
            R[R2L] = L_counter
            L_counter = 0
            R_counter += 1

        if i == S_len - 1:
            R[R2L] = L_counter

    logging.info(R)

    counter = 0
    while counter < S_len:
        if (R[counter] != 0):
            temp1 = R[counter]
            temp2 = R[counter + 1]
            R[counter] = (temp1 - temp1 // 2) + (temp2 // 2)
            R[counter + 1] = (temp1 // 2) + (temp2 - temp2 // 2)
            
            counter += 1
        counter += 1
            

    answer = ""
    for x in R:
        answer += str(x)
        answer += " "

    print(answer)
            
    
if __name__ == "__main__":
    main()
### BUGGY CODE ###

n = int(input())
l = [int(i) for i in input().split(" ")]

def meguru_nibutan(ar,m,key):
    a = m
    b = len(ar)
    while(abs(a-b) > 1):
        c = (a+b)//2
        if (ar[c] > key):
            a = c
        else:
            b = c
    return a

def main():
    cnt = 0
    l.sort(reverse=True)
    for a in range(0,n-2):
        for b in range(a+1,n-1):
            cnt += meguru_nibutan(l,b,l[a]-l[b]) - b
    print(cnt)

if (__name__ == "__main__"):
    main()

### FIXED CODE ###

import bisect
n = int(input())
l = list(map(int, input().split()))

def meguru_nibutan(ar,m,key):
    a = m
    b = len(ar)
    while(abs(a-b) > 1):
        c = (a+b)//2
        if (ar[c] > key):
            a = c
        else:
            b = c
    return a

def main():
    cnt = 0
    l.sort()
    for a in range(0,n-2):
        for b in range(a+1,n-1):
            #cnt += meguru_nibutan(l,b,l[a]-l[b]) - b
            cnt += bisect.bisect_left(l,l[a]+l[b]) - 1 - b
    print(cnt)

if (__name__ == "__main__"):
    main()