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

if __name__ == '__main__':
    store = list()
    for i in range(int(input())):
        parts = input().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(0, int(parts[1]))
        elif cmd == 'delete':
            num = int(parts[1])
            if num in store:
                store.remove(num)
        elif cmd == 'deleteFirst':
            store.remove(store[0])
        elif cmd =='deleteLast':
            store = store[:-1]

    if len(store) > 0:
        for n in store[:-1]:
            print(n, end=' ')
        print(store[-1])    


### FIXED CODE ###

class Node(object):
    def __init__(self, value, next=None, prev=None):
        self.value = value
        self.next = next
        self.prev = prev

class LinkedList(object):

    def __init__(self):
        self.dummy = Node(None)
        self.dummy.next = self.dummy
        self.dummy.prev = self.dummy

    def insert(self, x):
        node = Node(x, self.dummy.next, self.dummy)

        self.dummy.next.prev = node
        self.dummy.next = node
    
    def delete(self, x):
        node = self.dummy.next
        while node != self.dummy:
            if node.value == x:
                self.__remove_node(node)
                break
            else:
                node = node.next
    
    def deleteFirst(self):
        self.__remove_node(self.dummy.next)

    def deleteLast(self):
        self.__remove_node(self.dummy.prev)

    def __remove_node(self, node):
        if node != self.dummy:
            node.prev.next = node.next
            node.next.prev = node.prev

    def items(self):
        ret = []
        node = self.dummy.next
        while node != self.dummy:
            ret.append(node.value)
            node = node.next
        return ret

def main():
    from sys import stdin
    store = LinkedList()
    for i in range(int(input())):
        parts = stdin.readline().strip().split()
        cmd = parts[0]
        if cmd == 'insert':
            store.insert(parts[1])
        elif cmd == 'delete':
            store.delete(parts[1])
        elif cmd == 'deleteFirst':
            store.deleteFirst()
        elif cmd =='deleteLast':
            store.deleteLast()

    print(' '.join(store.items()))

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

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K = int(input())
S = 0

for i in range(1,K+1):
    if i==1:
        S+=K*K
        continue
    for j in range(1,K+1):
        if j==1:
            S+=K
            continue
        for k in range(1,K+1):
            if k==1:
                S+=1
            else:
                S += gcd(i,j,k)

print(S)


### FIXED CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)

def gcd_list(numbers):
    return reduce(math.gcd, numbers)

K = int(input())
S = 0

for i in range(1,K+1):
    for j in range(i+1,K+1):
        for k in range(j+1,K+1):
            S += gcd(i,j,k)*6

for i in range(1,K+1):
    for j in range(i+1,K+1):
        S+= gcd(i,j)*6

for i in range(1,K+1):
    S+=i

print(S)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
N,K,Q = map(int,input().split())
A_list = []
point_list = []

for i in range(Q):
    A_list.append(int(input()))

for i in range(N):
     if (K - (Q - A_list.count(i+1))) > 0 :
        print("Yes")
     else:
        print("No")
       

### FIXED CODE ###

# -*- coding: utf-8 -*-
import numpy as np
N,K,Q = map(int,input().split())
point_list = [K-Q]*N

for i in range(Q):
    point_list[int(input())-1] += 1 


for i in range (N):
    if point_list[i] > 0:
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

def solve():
    n = int(input())
    d = [0 for _ in range(n + 1)]
    ans = 0
    for i in range(1, n+1):
        for j in range(i, n+1, i):
            d[j] += j
    print(sum(d))




if __name__ == '__main__':
    solve()


### FIXED CODE ###

def solve():
    n = int(input())
    ans = 0
    for x in range(1, n + 1):
        ans += ((n // x) * ((n // x) + 1) * x) // 2
    print(ans)






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

N, M = map(int, input().split())
H = list(map(int, input().split()))
dai = [list(map(int, input().split())) for i in range(M)]
plus = [i for i in range(N)]


for i in range(0, N):
    if plus[i] == -1:
        continue
    else:
        for a, b in dai:
            if i+1 == a:
                if H[a - 1] > H[b - 1]:
                    plus[b-1] = -1
                    continue
                else:
                    plus[i] = -1
                    break
            if i+1 == b:
                if H[b - 1] > H[a - 1]:
                    plus[a-1] = -1
                    continue
                else:
                    plus[i] = -1
                    break
print(len(set(plus))-1)


### FIXED CODE ###

N, M = map(int, input().split())
H = list(map(int, input().split()))
dai = [list(map(int, input().split())) for i in range(M)]
plus = [i for i in range(N)]


for a, b in dai:
    if H[a - 1] > H[b - 1]:
        plus[b-1] = -1
        continue
    else:
        plus[a-1] = -1
    if H[b - 1] > H[a - 1]:
        plus[a-1] = -1
        continue
    else:
        plus[b-1] = -1
print(len(set(plus))-1)
### BUGGY CODE ###

def D():
    s = input()
    sketa = len(s)
    ans = 0
    mods = {0:1}
    for i in range(1,sketa+1):
        mod = int(s[-i:])%2019
        if mod in mods.keys():
            ans += mods[mod]
            mods[mod] += 1
        else:
            mods[mod] = 1
    print(ans)
D()


### FIXED CODE ###

def D():
    s = input()
    mods = [0]*2019
    mods[0] = 1
    mod = 0
    for i, element in enumerate(s[::-1]):
        mod += int(element)*pow(10,i,2019)
        mods[mod%2019] += 1
    print(sum(map(lambda x:int(x*(x-1)/2), mods)))
D()
### BUGGY CODE ###

N=int(input())
table=[[int(i) for i in input().split()] for j in range(0,N)]

for i in range(0,N-1):
    for j in range(0,10**9):
        if table[i][0]<=j*table[i+1][0]:
            for l in range(j,10**9):
                if table[i][1]<=l*table[i+1][1]:
                    table[i+1][1]=l*table[i+1][1]
                    table[i+1][0]=l*table[i+1][0]
                    break
            break

print(table[N-1][0]+table[N-1][1])


### FIXED CODE ###

N=int(input())
table=[[int(i) for i in input().split()] for j in range(0,N)]

for i in range(0,N-1):
    a=table[i][0]//table[i+1][0]
    A=table[i][0]%table[i+1][0]
    b=table[i][1]//table[i+1][1]
    B=table[i][1]%table[i+1][1]
    if a>b and A==0:
        table[i+1][0]=a*table[i+1][0]
        table[i+1][1]=a*table[i+1][1]
    elif a>b and not A==0:
        table[i+1][0]=(a+1)*table[i+1][0]
        table[i+1][1]=(a+1)*table[i+1][1]
    elif a<b and B==0:
        table[i+1][0]=b*table[i+1][0]
        table[i+1][1]=b*table[i+1][1]
    elif a<b and not B==0:
        table[i+1][0]=(b+1)*table[i+1][0]
        table[i+1][1]=(b+1)*table[i+1][1]
    elif a==b and A==0 and B==0:
        table[i+1][0]=a*table[i+1][0]
        table[i+1][1]=a*table[i+1][1]
    elif a==b and not A==0 and B==0:
        table[i+1][0]=(a+1)*table[i+1][0]
        table[i+1][1]=(a+1)*table[i+1][1]
    elif a==b and not B==0 and A==0:
        table[i+1][0]=(a+1)*table[i+1][0]
        table[i+1][1]=(a+1)*table[i+1][1]
    elif a==b and not B==0 and not A==0:
        table[i+1][0]=(a+1)*table[i+1][0]
        table[i+1][1]=(a+1)*table[i+1][1]

print(table[N-1][0]+table[N-1][1])
### BUGGY CODE ###

n=int(input())
p=list(map(int,input().split()))
ans=0
for i in range(n):
  if p[i] == min(p[:i+1]):
    #print(p[i])
    ans += 1
print(ans)

### FIXED CODE ###

n=int(input())
p=list(map(int,input().split()))
ans=0
a=p[0]
for i in range(n):
  a=min(a,p[i])
  if p[i] <= a:
    ans+=1
print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

def main():
    N, Q = [int(i) for i in input().split()]
    E = [tuple(int(i) for i in input().split()) for _ in range(N - 1)]
    V = [set() for _ in range(N)]
    for a, b in E:
        V[a - 1].add(b - 1)
        V[b - 1].add(a - 1)
    O = [tuple(int(i) for i in input().split()) for _ in range(Q)]
    C = [0] * N
    for p, x in O:
        C[p - 1] += x
    def add(n, x):
        C[n] += x
        for c in V[n]:
            V[c].remove(n)
            add(c, C[n])
    add(0, 0)
    print(' '.join(str(c) for c in C))

main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(10**7)

def main():
    N, Q = [int(i) for i in input().split()]
    V = [set() for _ in range(N)]
    for _ in range(N - 1):
        a, b = [int(i) - 1 for i in input().split()]
        V[a].add(b)
        V[b].add(a)
    C = [0] * N
    for _ in range(Q):
        p, x = [int(i) for i in input().split()]
        C[p - 1] += x
    cur = [(0, 0)]
    while cur:
        nxt = []
        for n, x in cur:
            C[n] = x = C[n] + x
            for c in V[n]:
                V[c].remove(n)
                nxt.append((c, x))
        cur = nxt
    print(' '.join(str(c) for c in C))

main()
### BUGGY CODE ###

n = int(input())
sum = 0
for i in range(n):
    sum += i;
print(sum)

### FIXED CODE ###

n = int(input())
print(n*(n-1)//2)
### BUGGY CODE ###

def main():
    N = int(input())
    count = 0
    for i in range(1, N):
        M = N // i + 1
        for j in range(1, M):
            k = N - i*j
            if k > 0 and N == i*j + k:
                count += 1

    print(count)


if __name__ == '__main__':
    main()


### FIXED CODE ###


def main():
    N = int(input())
    count = 0
    for i in range(1, N):
        for j in range(1, N // i + 1):
            k = N - i*j
            if k > 0:
                count += 1
    print(count)

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

N = int(input())
A = [format(int(a), "b").zfill(20) for a in input().split()]

Sum = [0] * 20
start = 0
end = 1
Ans = N
for i in range(20):
    Sum[i] += int(A[0][i])
while end < N:
    for i in range(20):
        Sum[i] += int(A[end][i])
    if 2 in Sum:
        while 2 in Sum:
            Ans += end - start - 1
            for j in range(20):
                Sum[j] -= int(A[start][j])
            start += 1
    end += 1
while start < N and 2 in Sum:
    for j in range(20):
        Sum[j] -= int(A[start][j])
    start += 1
Ans += (N - start - 1) * (N - start) // 2
print(Ans)

### FIXED CODE ###

N = int(input())
A = [format(int(a), "b").zfill(20) for a in input().split()]

Sum = [0] * 20
start = 0
end = 1
Ans = N
for i in range(20):
    Sum[i] += int(A[0][i])
while end < N:
    for i in range(20):
        Sum[i] += int(A[end][i])
    if 2 in Sum:
        while 2 in Sum:
            Ans += end - start - 1
            for j in range(20):
                Sum[j] -= int(A[start][j])
            start += 1
    end += 1
while start < N and 2 in Sum:
    for j in range(20):
        Sum[j] -= int(A[start][j])
    start += 1
Ans += (N - start - 1) * (N - start) // 2
print(Ans)
### BUGGY CODE ###

x=int(input())
a=0
b=0
def f(n):
    n1 = n**(1/5)
    if n1==int(n1):
        return True

l=set()
l.add(0)
i=1
while i<2*x:
    i1=i**5
    l.add(i1)
    if i%2==1:
        l.add(-i1)
    i+=1

for i in l:
    b=i
    a=x+b
    if a in l:
        if a!=0 and b!=0:
            a1=(a/abs(a))*(abs(a)**(1/5))
            b1=(b/abs(b))*(abs(b)**(1/5))
            print(int(a1),int(b1))
        elif b==0:
            a1=(a/abs(a))*(abs(a)**(1/5))
            print(int(a1),0)
        else:
            b1=(b/abs(b))*(abs(b)**(1/5))
            print(0,int(b1))
        break



### FIXED CODE ###

x=int(input())
a=0
b=0
def f(n):
    n1 = n**(1/5)
    if n1==int(n1):
        return True

l=set()
l.add(0)
i=1
while i**5<100*x:
    i1=i**5
    l.add(i1)
    if i%2==1:
        l.add(-i1)
    i+=1

for i in l:
    b=i
    a=x+b
    if a in l:
        if a!=0 and b!=0:
            a1=(a/abs(a))*(abs(a)**(1/5))
            b1=(b/abs(b))*(abs(b)**(1/5))
            print(int(a1),int(b1))
        elif b==0:
            a1=(a/abs(a))*(abs(a)**(1/5))
            print(int(a1),0)
        else:
            b1=(b/abs(b))*(abs(b)**(1/5))
            print(0,int(b1))
        break
### BUGGY CODE ###

from collections import deque

INF = 10**12

H, W = map(int, input().split())
sx, sy = map(int, input().split())
gx, gy = map(int, input().split())
maze = [input() for _ in range(H)]
sx -= 1
sy -= 1
gx -= 1
gy -= 1
walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
warp = [(i, j) for i in range(-2, 3)
        for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

q = deque()
d = [[INF] * W for _ in range(H)]
d[sx][sy] = 0
q.appendleft((sx, sy, 0))

while q:
    x, y, s = q.popleft()
    for dx, dy in walk:
        nx = x + dx
        ny = y + dy
        if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and d[nx][ny] > s:
            d[nx][ny] = s
            q.appendleft((nx, ny, s))
    for dx, dy in warp:
        nx = x + dx
        ny = y + dy
        if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and d[nx][ny] > s+1:
            d[nx][ny] = s + 1
            q.appendleft((nx, ny, s+1))

ans = d[gx][gy] if d[gx][gy] < INF else -1
print(ans)


### FIXED CODE ###

from collections import deque


H, W = map(int, input().split())
Ch, Cw = map(lambda x: int(x) - 1, input().split())
Dh, Dw = map(lambda x: int(x) - 1, input().split())
maze = [input() for _ in range(H)]

INF = 10 ** 12
path = [[INF] * W for _ in range(H)]  # path: 各マスへの移動コスト

# walk:移動A, warp:移動B
walk = [(0, 1), (0, -1), (-1, 0), (1, 0)]
warp = [(i, j) for i in range(-2, 3) for j in range(-2, 3) if (i, j) not in [(0, 0)] + walk]

q = deque()
path[Ch][Cw] = 0
q.append((Ch, Cw, 0))

while q:
    x, y, s = q.popleft()
    for dx, dy in walk:  # 移動A
        nx = x + dx
        ny = y + dy
        if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s:
            path[nx][ny] = s
            q.appendleft((nx, ny, s))  # 移動Aの場合はコスト0. キューの先頭に追加する.
    for dx, dy in warp:  # 移動B
        nx = x + dx
        ny = y + dy
        if 0 <= nx < H and 0 <= ny < W and maze[nx][ny] == '.' and path[nx][ny] > s + 1:
            path[nx][ny] = s + 1
            q.append((nx, ny, s + 1))  # 移動Bの場合はコスト1. キューの最後尾に追加する.
    
ans = path[Dh][Dw] if path[Dh][Dw] < INF else '-1'
print(ans)
### BUGGY CODE ###

def pos(x, n, m):
    if n == 0:
        return 1
    res = pos(x*x%m, n//2, m)
    if n%2 == 1:
        res = res*x%m
    return res

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

MOD=10**9+7

ans=0
for i in range(60):
    count1=0
    count0=0
    for j in range(N):
        if A[j]>>i & 1:
            count1+=1
        else:
            count0+=1
    ans+=count0*count1%MOD*pos(2,i,MOD)
    ans%=MOD
print(ans)

### FIXED CODE ###

def pos(x, n, m):
    if n == 0:
        return 1
    res = pos(x*x%m, n//2, m)
    if n%2 == 1:
        res = res*x%m
    return res

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

MOD=10**9+7

ans=0
for i in range(60):
    count1=0
    count0=0
    for j in range(N):
        if A[j]>>i & 1:
            count1+=1
        else:
            count0+=1
    ans+=count0*count1%MOD*pos(2,i,MOD)
    ans%=MOD
print(ans)
### BUGGY CODE ###

def comb2(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    res=1
    for i in range(r):
        res*=(n-i)%MOD*pow(i+1, MOD-2, MOD)%MOD
    return res%MOD

MOD=10**9+7

N, A, B=map(int, input().split())
ans=pow(2, N)-comb2(N, A)-comb2(N, B)-1
print(ans)

### FIXED CODE ###

def comb2(n, r):
    if r<0 or r>n:
        return 0
    r=min(r, n-r)
    res=1
    for i in range(r):
        res=res*(n-i)%MOD*pow(i+1, MOD-2, MOD)%MOD
    return res

MOD=10**9+7

N, A, B=map(int, input().split())
ans=pow(2, N, MOD)-comb2(N, A)-comb2(N, B)-1
print(ans%MOD)
### BUGGY CODE ###

n,m=map(int,(input().split(' ')))
a=list(map(int,input().split(' ')))
while m:
    m-=1
    r=max(a)
    a.remove(r)
    r//=2
    a.append(r)
print(sum(a))

### FIXED CODE ###

#!/usr/bin/python3

import heapq

def main():
    line1 = input()
    line2 = input()

    n, m = list(map(int, line1.split()))
    l = list(map(int, line2.split()))
    ans = sum(l)
    for i in range(len(l)):
        l[i] *= -1
    heapq.heapify(l)
    for i in range(m):
        price = heapq.heappop(l) * (-1)
        new_price = price // 2
        heapq.heappush(l, new_price * (-1))
        ans -= (price - new_price)
    print(ans)
    return

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

A,B,M=map(int,input().split())
vecA=list(map(int,input().split()))
vecB=list(map(int,input().split()))
matX=[input().split() for k in range(M)]
price = 10**6
for i in range(0,M):
    pricecom = int(vecA[int(matX[i][0]) -1]) + int(vecB[int(matX[i][1]) -1]) - int(matX[i][2])
    if pricecom<= price:
        price=pricecom
    else:
        pass
for m in range(A):
    for n in range (B):
        price2=int(vecA[m]) + int(vecB[n])
        if price2<=price:
            price=price2
print(price)

### FIXED CODE ###

A,B,M=map(int,input().split())
vecA=list(map(int,input().split()))
vecB=list(map(int,input().split()))
matX=[input().split() for k in range(M)]
price = 10**6
for i in range(0,M):
    pricecom = int(vecA[int(matX[i][0]) -1]) + int(vecB[int(matX[i][1]) -1]) - int(matX[i][2])
    if pricecom<= price:
        price=pricecom
    else:
        pass
price2=int(min(vecA)) + int(min(vecB))
if price2<=price:
    price=price2
print(price)
### BUGGY CODE ###

def main():
    n = int(input())
    a = list(map(int, input().split()))
    a.sort()
    a = tuple(a)

    ans = [0] * n
    for i in range(len(a) - 1):
        if ans[i] == 1:
            continue
        for j in range(i + 1, len(a)):
            if a[i] == a[j]:
                ans[i] = 1
                ans[j] = 1
            else:
                if a[j] % a[i] == 0:
                    ans[j] = 1
    print(n - sum(ans))


if __name__ == "__main__":
    main()

### FIXED CODE ###

def main():
    n = int(input())
    a = tuple(map(int, input().split()))

    ans = 0
    mx = max(a) + 1
    dp = [0] * mx
    for i in a:
        for j in range(i, mx, i):
            dp[j] += 1
    for i in a:
        if dp[i] == 1:
            ans += 1

    print(ans)


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

import sys
import numpy as np
input = sys.stdin.readline

def main():
    H, W, A, B = map(int, input().split())

    if A * 2 > W or B * 2 > H:
        print("No")
        return
    
    ans = np.zeros((H, W), dtype=int)
    ans[:H-B, W-A:] = 1
    ans[H-B:, :W-A] = 1
    
    for i in range(H):
        for j in range(W):
            print(ans[i][j], end="")
        print()


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
input = sys.stdin.readline

def main():
    H, W, A, B = map(int, input().split())

    if A * 2 > W or B * 2 > H:
        print("No")
        return
    
    for i in range(H-B):
        for j in range(W-A):
            print(1, end="")
        for j in range(A):
            print(0, end="")
        print()
    for i in range(B):
        for j in range(W-A):
            print(0, end="")
        for j in range(A):
            print(1, end="")
        print()


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

def main():
    N = int(input())
    P = list(map(int, input().split()))

    ans = 0
    for i in range(N):
        for j in reversed(range(0, i)):
            if P[j] < P[i]:
                break
        else:
            ans += 1
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    N = int(input())
    P = list(map(int, input().split()))

    ans = 1
    m = P[0]
    for i in range(1, N):
        if P[i] > m:
            continue
        m = min(m, P[i])
        ans += 1
    print(ans)


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

import sys
input = sys.stdin.readline
M = 10**9+7
n = int(input())
l = list(map(int,input().split()))
x = max(l)
s = bin(x)
u = len(s)-2
o = [0]*u
z = [0]*u
for i in l:
    x = bin(i)
    x = x[2:]
    a = list(x)
    d = u - len(a)
    a = (["0"] * d) + a
    j = 0
    while(j < len(o)):
        if a[j] == "1":
            o[j] = o[j]+1

        else:
            z[j] = z[j]+1

        j = j+1


cnt = 0
for r in range(len(l)-1):
    i = l[r]
    x = bin(i)
    x = x[2:]
    a = list(x)
    d = u-len(a)
    a = (["0"]*d)+a
    j = u-1
    y = 0
    while(j > -1):
        if a[y] == "0":
            z[y] = z[y]-1
            cnt = (cnt+((2**j)*o[y])%M)%M

        if a[y] == "1":
            o[y] = o[y]-1
            cnt = (cnt + ((2 ** j) * z[y]) % M) % M

        y = y+1
        j = j-1

print(cnt)

### FIXED CODE ###

def readinput():
    n=int(input())
    l=list(map(int,input().split()))
    return n,l

def main(n,a):
    MOD=10**9+7
    hist=[0]*61
    bs=[]
    for i in range(n):
        # s=list(reversed(bin(a[i])[2:]))
        # for j in range(len(s)):
        #     if s[j]=='1':
        #         hist[j]+=1
        # bs.append(s)

        s=bin(a[i])[2:]
        for j in range(len(s)):
            if s[j]=='1':
                hist[len(s)-j-1]+=1
        # j=0
        # ai=a[i]
        # while ai>0:
        #     if ai&1==1:
        #         hist[j]+=1
        #     ai = ai >> 1
        #     j+=1


    #print(bs)
    #print(hist)
    #print(hist)
    sum=0
    # for i in range(n-1):
    #     s=bs[i]
    #     b=1
    #     for j in range(len(s)):
    #         if s[j]=='0':
    #             sum=(sum+hist[j]*b)%MOD
    #         else:
    #             sum=(sum+( n-i-hist[j] )*b)%MOD
    #             hist[j]-=1
    #         b*=2
    #     for j in range(len(s),61):
    #         sum=(sum+hist[j]*b)%MOD
    #         b*=2
    b=1
    for j in range(61):
        sum=(sum+( hist[j]*(n-hist[j])*b )%MOD )%MOD
        b*=2

    return sum

if __name__=='__main__':
    n,l=readinput()
    ans=main(n,l)
    print(ans)
### BUGGY CODE ###

# import bisect
# from collections import Counter, deque
# import copy
# from fractions import gcd
# from functools import reduce
# from itertools import accumulate, permutations, combinations, combinations_with_replacement, groupby, product
#import math
import numpy as np
import sys
sys.setrecursionlimit(10 ** 5 + 10)
# input = sys.stdin.readline

def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)

    Z=[np.median(Y[:i]+Y[i+1:]) for i in range(N)]

    for i in range(N):
        print(int(Z[Y.index(X[i])]))



resolve()

### FIXED CODE ###

def resolve():
    N=int(input())
    X=list(map(int,input().split()))
    Y=sorted(X)
    l=Y[N // 2-1]
    r=Y[N//2]


    for i in X:
        if i<r:
            print(r)
        else:
            print(l)






resolve()
### BUGGY CODE ###

a=int(input())
b=list(map(int,input().split()))
c=1
for i in range(a):
    c*=b[i]
if c>1000000000000000000:
    print(-1)        
else:
    print(c)

### FIXED CODE ###

a=int(input())
b=list(map(int,input().split()))
c=1
b.sort()
if 0 in b:
    print(0)
else:
    b.sort(reverse=True)
    for i in range(a):
        c*=b[i]
        if c>1000000000000000000:
            print(-1)        
            break
    else:
        print(c)