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

N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

m = max(T)
mm = m
while True:
    flg =False
    for j in range(N):
        if m % T[j] != 0:
            flg = True
            break
    if flg == True:
        m += mm
    else:
        print(m)
        exit()


### FIXED CODE ###

def gcd(a,b):
    while b:
        a,b = b,a%b
    return a


def lcm(a,b):
    return (a*b) // gcd(a,b)


N = int(input())
T = []
for i in range(N):
    T.append(int(input()))

t = T[0]
for i in range(N - 1):
    t = lcm(t,T[i+1])
print(t)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
q = 0
p = []*10
m = []*10
for i in range(10):
    p.append([])
    m.append([])
for i in range(n):
    x = i+1-a[i]
    if(x > 0):
        if(x in p[x%10]):
            m[x%10][p[x%10].index(x)][0] += 1
        else:
            m[x%10].append([1,0])
            p[x%10].append(x)
    x = i+1+a[i]
    if(x in p[x%10]):
        m[x%10][p[x%10].index(x)][1] += 1
    else:
        m[x%10].append([0,1])
        p[x%10].append(x)
    
for i in range(10):
    for j in range(len(m[i])):
        q += m[i][j][0]*m[i][j][1]
print(q)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
q = 0
z = 1000
p = []*z
m = []*z
for i in range(z):
    p.append([])
    m.append([])
for i in range(n):
    x = i+1-a[i]
    if(x > 0):
        if(x in p[x%z]):
            m[x%z][p[x%z].index(x)][0] += 1
        else:
            m[x%z].append([1,0])
            p[x%z].append(x)
    x = i+1+a[i]
    if(x in p[x%z]):
        m[x%z][p[x%z].index(x)][1] += 1
    else:
        m[x%z].append([0,1])
        p[x%z].append(x)
    
for i in range(z):
    for j in range(len(m[i])):
        q += m[i][j][0]*m[i][j][1]
print(q)
### BUGGY CODE ###

import numpy as np
N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
ans = np.array([K]*N)
minus = np.array([-1]*N)
for i in range(1, Q+1): # round
    minus[A[i-1]-1] = 0
    ans += minus
    minus = np.array([-1]*N)    
for k in ans:
    if k <= 0:
        print('No')
    else:
         print('Yes')

### FIXED CODE ###

N, K, Q = map(int, input().split())
A = [int(input()) for _ in range(Q)]
ans = [K-Q]*N
for i in range(1,Q+1):
    ans[A[i-1]-1] += 1    
for k in ans:
    if k <= 0:
        print('No')
    else:
         print('Yes')
### BUGGY CODE ###

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

while M>0:
    A[A.index(max(A))] /= 2
    M -= 1


ans = 0

for i in A:
    ans += int(i)

print(ans)


### FIXED CODE ###

import heapq

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

B = []

for i in A:
    B.append(-i)

heapq.heapify(B)

for i in range(M):
    tmp = heapq.heappop(B)
    heapq.heappush(B,-1*(-tmp//2))

print(-sum(B))
### BUGGY CODE ###

N = int(input())
l = list(map(int, input().split()))
set_l = set(l)

dictionary = {ll: l.count(ll) for ll in set_l}
ll_dict = {}

cnt = 0
for k, v in dictionary.items():
  cnt += v*(v-1)//2

for n in range(N):
  print(cnt-(dictionary[l[n]]-1))

### FIXED CODE ###

from collections import Counter

N = int(input())
l = list(map(int, input().split()))
set_l = set(l)

dictionary = Counter(l)
ll_dict = {}

cnt = 0
for k, v in dictionary.items():
  cnt += v*(v-1)//2

for n in range(N):
  print(cnt-(dictionary[l[n]]-1))
### BUGGY CODE ###

def main():
    N,K=map(int,input().split())
    L=list(map(int,input().split()))
    LL=[L[i]*L[i+j] for i in range(0,N) for j in range(1,N-i)]
    print(sorted(LL)[K-1])
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline
N,K=map(int,input().split())
L=[int(i) for i in input().split()]
Pos = [x for x in L if x > 0]
Zero = [x for x in L if x == 0]
Neg = [x for x in L if x < 0]
Pos.sort()
Neg.sort(reverse=True)

Po = len(Pos)
Ne = len(Neg)
Ze= len(Zero)

ZeN = Ze*(Ze-1)//2 + Ze*(Po+Ne)
NeN = Po*Ne

if NeN<K<=NeN+ZeN:
    print(0)

else:
    def f(x):
        cnt = 0
        if x < 0:
            j = Po - 1
            for i in range(Ne):
                j=min(Po-1,j+1)
                while j >=0:
                    if Neg[i] * Pos[j] <= x:
                        j = j - 1
                    else:
                        break
                cnt = cnt + Po - j - 1
        else:
            j = 0
            for i in range(Po)[::-1]:
                j=max(0,j-1)
                while j < i:
                    if Pos[i]*Pos[j] <= x:
                        j = j+1
                    else:
                        break
                cnt = cnt+j

            j = 0
            for i in range(Ne)[::-1]:
                j = max(0, j - 1)
                while j < i:
                    if Neg[i]*Neg[j] <= x:
                        j = j+1
                    else:
                        break
                cnt = cnt+j

            cnt = cnt + ZeN + NeN
        return(cnt)

    Hi = 10**18
    Lo = -10**18

    while Hi-Lo > 1:
        Mid = (Hi + Lo) // 2
        if f(Mid) >= K:
            Hi = Mid
        else:
            Lo = Mid
    print(Hi)
### BUGGY CODE ###

n = int(input())
dlist = []
for i in range(n):
    code = input().split()
    if code[0] == "insert":
        dlist.insert(0,code[1])
    if code[0] == "delete":
        try:
            dlist.remove(code[1])
        except:
            continue
    if code[0] == "deleteFirst":
        dlist.pop(0)
    if code[0] == "deleteLast":
        dlist.pop()
print(*dlist,sep=" ")

### FIXED CODE ###

from collections import deque
n = int(input())
dlist = deque()
for i in range(n):
    code = input().split()
    if code[0] == "insert":
        dlist.insert(0,code[1])
    if code[0] == "delete":
        try:
            dlist.remove(code[1])
        except:
            continue
    if code[0] == "deleteFirst":
        dlist.popleft()
    if code[0] == "deleteLast":
        dlist.pop()
print(*dlist,sep=" ")
### BUGGY CODE ###

import itertools
X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse = True)[:200]
B = sorted([int(i) for i in input().split()], reverse = True)[:200]
C = sorted([int(i) for i in input().split()], reverse = True)[:200]

D = []
for a, b, c in itertools.product(A, B, C):
    d = a + b + c
    D.append(d)
    
D.sort(reverse = True)
for d in D[:K]:
    print(d)

### FIXED CODE ###

X, Y, Z, K = map(int, input().split())
A = sorted([int(i) for i in input().split()], reverse = True)
B = sorted([int(i) for i in input().split()], reverse = True)
C = sorted([int(i) for i in input().split()], reverse = True)

D = []
for i in range(X):
    for j in range(Y):
        if (i + 1) * (j + 1) > K:
            break
        for k in range(Z):
            if (i + 1) * (j + 1) * (k + 1) > K:
                break
            D.append(A[i] + B[j] + C[k])
            #print(A[i] + B[j] + C[k], i, j, k)
            
D.sort(reverse = True)
for d in D[:K]:
    print(d)
### BUGGY CODE ###

n,k=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
l,r=2*(10**18)+1,0
while l-r>1:
    t=(l+r)//2
    c=0
    for i,j in a:
        c+=max(0,(t-i)//j+1)
    if c<k:
        r=t
    else:
        l=t
print(l)

### FIXED CODE ###

n,k=map(int,input().split())
a=[list(map(int,input().split()))for i in range(n)]
l,r=2*(10**18)+1,0
while l-r>1:
    t=(l+r)//2
    c=0
    for i,j in a:
        c+=max(0,(t-i)//j+1)
    if c<k:
        r=t
    else:
        l=t
print(l)
### BUGGY CODE ###

import itertools

def main():
    n,m,x = map(int,input().split())
    ans = 0
    tmp = 10 ** 7
    ca = [[0]*m for i in range(n)]
    nn = [i for i in range(n)]

    for _ in range(n):
        ca[_] = list(map(int, input().split()))

    xx = list(itertools.permutations(nn))

    for ii in xx:
        ans = 0
        a = [0 for i in range(m)]

        for _ in ii:
            cost = ca[_][0]
            chk = 0
            for i in range(m):
                a[i] += ca[_][i+1]
                if a[i] < x:
                    chk = 1

            ans += cost
            if chk == 0:
                if tmp > ans:
                    tmp = ans
                break
            
        if tmp == 10 ** 7:
            print(-1)
            exit()

    print(tmp)

 
if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n,m,x = map(int,input().split())
    a = [[] for _ in range(n)]
    c = [0] * n

    INF = 10 ** 9
    ans = INF

    for i in range(n):
        ca = list(map(int,input().split()))
        c[i],a[i] = ca[0],ca[1:]

    for s in range(0,1<<n):
        smart = [0] * m
        cost = 0
        for i in range(n):
            if(s>>i) % 2 == 0:continue
            cost += c[i]
            for j in range(m):
                smart[j] += a[i][j]
        ok = True
        for i in range(m):
            if smart[i] < x:
                ok = False
        if ok:
            ans = min(ans,cost)
    if ans == INF:
        ans = -1
    
    print(ans)

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

import heapq
def SME(start,end):
    A = []
    if end > N : end = N
    count = 0
    count2 = 0
    for i,x in enumerate(Whole[start:end]):
        heapq.heappush(A,[x,i])
    for j in range(start,end):
        a = heapq.heappop(A)
        tmp = count
        for i in range(L):
            idx = a[1] + i
            try :
                if ANS[idx] : continue
                else :
                    ANS[idx] = a[0]
                    count += 1
            except IndexError : continue
        if count == tmp : count2 += 1
        if count2 > 200 : break
    for i in range(L):
        if ANS[i] : continue
        else : ANS[i] = min(Whole[:i+1])
    for i in range(L,N):
        if ANS[i] : continue
        else : ANS[i] = min(Whole[i+1-L:i+1])
    return ANS

[N,L] = [int(x) for x in input().split()]
Whole = [int(x) for x in input().split()]
parameter = 0.97
ANS = [None]*N
ANS = SME(0, N)
for i in ANS[L-1:-1]:print(i, end=" ")
print(ANS[-1])

### FIXED CODE ###

def ascend(a,b):
    mini = min(A[a:a+L])
    ans[a] = mini
    for i in range(a+1,b):
        if A[i+L-1] <= mini : mini = A[i+L-1]
        elif A[i-1] == mini : mini = min(A[i:i+L])
        ans[i] = mini

def descend(a,b):
    mini = min(A[b-1:b+L-1])
    ans[b-1] = mini
    for i in range(b-2,a-1,-1):
        if A[i] <= mini : mini = A[i]
        elif A[i+L] == mini: mini = min(A[i:i+L])
        ans[i] = mini
    
[N,L] = [int(x) for x in input().split()]
A = [int(x) for x in input().split()]
ans = [None]*(N-L+1)
count = 0;
if N > 10 ** 4:
    for i in range(100):
        if A[i+1] > A[i] : count += 1
    if count > 80 : descend(0, N-L+1)
    else : ascend(0,N-L+1)
else :
    ascend(0, N-L+1)
for i in ans[:-1] : print(i, end=" ")
print(ans[-1])
### BUGGY CODE ###

# coding: utf-8

N = int(input())
S = input()


def kawaru_hito(s, leader):
    left_of_leader = s[:leader]
    right_of_leader = s[leader+1:]
    return left_of_leader.count("W") + right_of_leader.count("E")

res = 1000000
for i in range(len(S)):
    res = min(res, kawaru_hito(S, i))

print(res)


### FIXED CODE ###

# coding: utf-8

N = int(input())
S = input()

east = S.count("E")
west = 0


res = 1000000
for i in range(len(S)):
    if S[i] == "E":
        east -= 1
    res = min(res, east + west)
    if S[i] == "W":
        west += 1

print(res)
### BUGGY CODE ###

import sys

def longestcommonsubsequence(seq1, seq2):
    a,b = len(seq1)+1, len(seq2)+1
    length = [[0 for i in range(b)] for j in range(a)]

    for i in range(a):
        for j in range(b):
            if i==0 or j==0:
                length[i][j]=0
            else:
                if seq1[i-1] == seq2[j-1]:
                    length[i][j] = length[i-1][j-1] + 1
                else:
                    length[i][j] = max(length[i-1][j], length[i][j-1])
    return length[a-1][b-1]

n = input()
for i in range(n):
    seq1 = raw_input()
    seq2 = raw_input()
    
    print longestcommonsubsequence(seq1, seq2)

### FIXED CODE ###

import sys

def longestcommonsubsequence():
    seq1 = raw_input()
    seq2 = raw_input()

    a, b = len(seq1), len(seq2)
    x1 = [0 for i in range(b+1)]
    for i in range(a):
        e1 = seq1[i]
        x2 = x1+[]
        #x1 = [0 for i2 in range(b+1)]
        for j in range(b):
            if e1 == seq2[j]:
                x1[j+1] = x2[j] + 1
            elif x1[j+1]<x1[j]:
                x1[j+1] = x1[j]
    return x1[-1]

n = input()
for i2 in range(n):

    print longestcommonsubsequence()
### BUGGY CODE ###

n = int(input())
s = list(map(int, input().split()))
ans = 1
for i in s:ans*=i
if(ans > 10**18):print(-1)
else:print(ans)

### FIXED CODE ###

n = int(input())
s = list(map(int, input().split()))
if 0 in s:print(0);exit()
ans=1
for i in s:
  ans*=i
  if(ans > 10**18):print(-1);exit()
print(ans)
### BUGGY CODE ###

import math
k = int(input())

ans = 0

for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            x = math.gcd(a, b)
            y = math.gcd(x, c)
            ans += y

print(ans)


### FIXED CODE ###

import math
k = int(input())

ans = 0

for a in range(1, k+1):
    for b in range(1, k+1):
        for c in range(1, k+1):
            x = math.gcd(a, b)
            y = math.gcd(x, c)
            ans += y

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

n, m = map(int, input().split())
k = []
for i in range(m):
    l, r = map(int, input().split())
    k.append(list(range(l, r + 1)))

flag = [0] * n
for i in range(n):
    count = 0
    for j in k:
        if (i + 1) in j:
            count += 1
    if count == m:
        flag[i] = 1

print(sum(flag))

### FIXED CODE ###

n, m = map(int, input().split())
L = []
R = []
for i in range(m):
    l, r = map(int, input().split())
    L.append(l)
    R.append(r)
count = min(R) - max(L) + 1
if count <= 0:
    print(0)
else:
    print(count)
### BUGGY CODE ###

from bisect import bisect_left
import sys
input = sys.stdin.readline

N, M, Q = map(int, input().split())

LR = [[] for _ in range(N)]
for _ in range(M) :
    L, R = map(int, input().split())
    LR[L-1].append(R-1)
for i in range(N) :
    LR[i].sort()

for _ in range(Q) :
    p, q = map(int, input().split())
    p -= 1
    q -= 1
    ret = 0
    for i in range(p, N) :
        ret += bisect_left(LR[i], q+1)
    print(ret)

### FIXED CODE ###

from bisect import bisect_left
import sys
input = sys.stdin.readline

N, M, Q = map(int, input().split())

dp = [[0] * (N + 1) for _ in range(N + 1)]
for _ in range(M) :
    L, R = map(int, input().split())
    dp[L][R] += 1

for i in range(N + 1) :
    for j in range(N + 1) :
        if 0 <= i - 1 :
            dp[i][j] += dp[i-1][j]
        if 0 <= j - 1 :
            dp[i][j] += dp[i][j-1]
        if 0 <= i - 1 and 0 <= j - 1 :
            dp[i][j] -= dp[i-1][j-1]

for _ in range(Q) :
    p, q = map(int, input().split())
    print(dp[q][q]-dp[p-1][q]-dp[q][p-1]+dp[p-1][p-1])
### BUGGY CODE ###

H, W, K = map(int, input().split())
S = [list(input()) for i in range(H)]

fans = 10 ** 5
for i in range(1 << (H-1)):
    slc = []
    scnt = 1
    ans = 0
    switch = 1
    for j in range(H-1):
        if (i >> j) % 2 == 1:
            slc.append(j+1)
            scnt += 1
            ans += 1
    slc.append(H)
    stock = [0] * scnt 
    for j in range(W):
        kari = [0] * scnt
        ss = slc[0]
        idx = 0
        for k in range(H):
            if ss == k:
                idx += 1
                ss = slc[idx]
            if S[k][j] == "1":
                kari[idx] += 1
            if kari[idx] > K:
                switch = 0
                break
        if switch == 0:
            break
        for k in range(scnt):
            if stock[k] + kari[k] <= K:
                stock[k] += kari[k]
            else:
                stock = kari
                ans += 1
                break
    if switch == 1:
        fans = min(fans, ans)

print(fans)

### FIXED CODE ###

H, W, K = map(int, input().split())
S = [list(input()) for i in range(H)]

fans = 10 ** 5
for i in range(1 << (H-1)):
    slc = []
    scnt = 1
    ans = 0
    switch = 1
    for j in range(H-1):
        if (i >> j) % 2 == 1:
            slc.append(j+1)
            scnt += 1
            ans += 1
    slc.append(H)
    stock = [0] * scnt 
    for j in range(W):
        kari = [0] * scnt
        ss = slc[0]
        idx = 0
        for k in range(H):
            if ss == k:
                idx += 1
                ss = slc[idx]
            if S[k][j] == "1":
                kari[idx] += 1
            if kari[idx] > K:
                switch = 0
                break
        if switch == 0:
            break
        for k in range(scnt):
            if stock[k] + kari[k] <= K:
                stock[k] += kari[k]
            else:
                stock = kari
                ans += 1
                break
    if switch == 1:
        fans = min(fans, ans)

print(fans)
### BUGGY CODE ###

H, W, M = map(int, input().split())

bomb = []
row = [0] * H
column = [0] * W

for i in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    
    bomb.append([h, w])
    
    row[h] += 1
    column[w] += 1
    
row_max = max(row)
col_max = max(column)

r_check = []
c_check = []
for i in range(H):
    if row[i] == row_max:
        r_check.append(i)

for i in range(W):
    if column[i] == col_max:
        c_check.append(i)

num = len(r_check) * len(c_check)

ans = row_max + col_max - 1
if M < num:
    ans = row_max + col_max
else:
    for r in r_check:
        for c in c_check:
            if not [r, c] in bomb:
                ans = row_max + col_max
                break

print(ans)

### FIXED CODE ###

H, W, M = map(int, input().split())

bomb = set()
row = [0] * H
column = [0] * W

for i in range(M):
    h, w = map(int, input().split())
    h -= 1
    w -= 1
    
    bomb.add((h, w))
    
    row[h] += 1
    column[w] += 1
    
row_max = max(row)
col_max = max(column)

r_check = []
c_check = []
for i in range(H):
    if row[i] == row_max:
        r_check.append(i)

for i in range(W):
    if column[i] == col_max:
        c_check.append(i)

num = len(r_check) * len(c_check)

ans = row_max + col_max - 1
flg = False
if M < num:
    ans += 1
else:
    for r in r_check:
        if flg:
            break
        for c in c_check:
            if not (r, c) in bomb:
                ans += 1
                flg = True
                break

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

N, W = map(int, input().split())
dp = [0]*(W+1)

for i in range(N):
  wi, vi = map(int, input().split())
  for w in range(W, wi-1, -1):
    dp[w] = max(dp[w], dp[w-wi]+vi)

print(max(dp))


### FIXED CODE ###

import sys
input = sys.stdin.readline
 
def main():
    N,W = map(int,input().split())
    dp = [-1 for _ in range(W+1)]
    dp[W] = 0
    for _ in range(N):
        nm,nv = [int(a) for a in input().split()]
        for j in range(nm,W+1):
            a = nm
            if dp[j] == -1:
                continue
            if dp[j-a] < dp[j] + nv:
                dp[j-a] = dp[j] + nv
    print(max(dp))
 
if __name__ == "__main__":
    main()
### BUGGY CODE ###

import sys
import math


def deg(v1,v2):
    normv1 = math.sqrt(v1[0]**2+v1[1]**2)
    normv2 = math.sqrt(v2[0]**2+v2[1]**2)
    if normv1 == 0 or normv2 == 0:
        print "ERROR"; exit()
    return (v1[0]*v2[0]+v1[1]*v2[1])/(normv1*normv2)

def calc_hull(d):
    hull = []
    point_first = d[0]
    hull.append(point_first)
    v = [ 1, 0 ]
    oldpoint=point_first
    while True:
        minipoint = 0;
        minv = [ 0,0 ]
        maxcos = -1
        for p in d:
            if p == oldpoint: continue
            o = [ p[i]-oldpoint[i] for i in xrange(2) ]
            cos = deg(o,v)
            if cos > maxcos:
                maxcos = cos
                minv = o
                minpoint = p
        if minpoint == point_first: break
        v = minv
        oldpoint = minpoint
        hull.append(minpoint)
    return hull

while True:
    n = int(raw_input())
    if n == 0: break
    d = []
    for t in xrange(n):
        d.append(map(float,raw_input().split(",")))
    h = calc_hull(sorted(d,key=lambda x:-x[1]))
    print len(d) - len(calc_hull(d))

### FIXED CODE ###

import sys

def calc_hull(d,direction):
    maxcos0 = {"r":-1.0,"l":1.0}
    hull = [d[0]]
    p = d[0]
    while True:
        maxcos = maxcos0[direction]
        for i in xrange(1,len(d)):
            if d[i][1] < p[1]  or d[i] == p: continue
            v = [ d[i][0]-p[0] , d[i][1]-p[1] ]
            c = v[0]/(v[0]**2+v[1]**2)**0.5
            if c >= maxcos and direction == "r":
                maxcos = c
                q = d[i]
            if c <= maxcos and direction == "l":
                maxcos = c
                q = d[i]
        p = q
        hull.append(q)
        if q == d[-1]: break
    return hull

while True:
    n = int(raw_input())
    if n == 0: break
    d = []
    for t in xrange(n):
        d.append(map(float,raw_input().split(",")))
    d.sort(key = lambda x:x[1])
    print len(d) - ( len( calc_hull(d,"r") + calc_hull(d,"l") ) - 2)
### BUGGY CODE ###

S=input()
p=0
cnt=0
while(p!=len(S)):
    for i in range(p+1,len(S)+1):
        if int(S[p:i])%2019==0:
            cnt+=1
    p+=1
print(cnt)

### FIXED CODE ###

s=input()
mod=2019
dp=[0]*mod
k=0
t=1
for x in map(int,s[::-1]):
    k+=t*x
    k%=mod
    dp[k]+=1
    t*=10
    t%=mod
print(sum(i*(i-1)//2 for i in dp)+dp[0])
### BUGGY CODE ###

n,m = map(int,input().split())
V = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    V[a].append(b)
    V[b].append(a)
from collections import deque
q = deque([])
q.append(1)
reach = [0]*(n+1)
reach[0] = -1
while q:
    x = q.popleft()
    for v in V[x]:
        if reach[v] == 0:
            q.append(v)
            reach[v] = reach[x]+1
    if max(reach) >= 3:
        break
if reach[-1] == 2:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")

### FIXED CODE ###

n,m = map(int,input().split())
V = [[] for i in range(n+1)]
for i in range(m):
    a,b = map(int,input().split())
    V[a].append(b)
    V[b].append(a)
W = V[1]
z = []
for x in W:
    z.append(V[x])
s = 0
for q in z:
    if n in q:
        s = 1
        break
if s == 1:
    print("POSSIBLE")
else:
    print("IMPOSSIBLE")
### BUGGY CODE ###

n=int(input())
c=[''.join(sorted(input())) for _ in range(n)]
x=[x for x in set(c) if c.count(x) > 1]
an=0

for i in x:
    t=c.count(i)
    for j in range(t):
        an+=j

print(an)

### FIXED CODE ###

n=int(input())
c=[''.join(sorted(input())) for _ in range(n)]
an=0
d={}

for i in c:
    if i in d:
        an += d[i]
        d[i]+=1
    else:
        d[i]=1

print(an)
### BUGGY CODE ###

import sys

sys.setrecursionlimit(10 ** 9)

S = input()
K = int(input())

chars = sorted(set(S))
checked = set()


def dfs(s):
    for c in chars:
        next_s = s + c
        if next_s not in checked and next_s in S:
            checked.add(next_s)
            if len(checked) == K:
                print(next_s)
                return
            elif len(next_s) <= len(S):
                dfs(next_s)


dfs('')


### FIXED CODE ###

import sys

sys.setrecursionlimit(10 ** 9)

S = input()
K = int(input())

chars = sorted(set(S))
checked = set()


def dfs(s):
    for c in chars:
        if len(checked) >= K:
            return
        next_s = s + c
        if next_s not in checked and next_s in S:
            checked.add(next_s)
            if len(checked) == K:
                print(next_s)
                return
            elif len(next_s) <= len(S):
                dfs(next_s)


dfs('')
### BUGGY CODE ###

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

triangles = set()
for i, a in enumerate(l[:-2]):
    for j, b in enumerate(l[i+1:-1], i+1):
        for k, c in enumerate(l[j+1:], j+1):
            if a + b > c and b + c > a and a + c > b:
                triangles.add(tuple(sorted([a, b, c])))

print(len(triangles))

### FIXED CODE ###

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

l.sort()
count = 0
  
for i in range(0,n-2): 

    k = i + 2

    for j in range(i+1,n): 

        while (k < n and l[i] + l[j] > l[k]): 
            k += 1

        if(k>j): 
            count += k - j - 1

print(count)