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

N = int(input())
a = list(map(int,input().split()))
q = int(input())
bc = list()
sum_a = 0
output = 0
cnt = 0
for i in range(q):
  bc.append(list(map(int,input().split())))
a.sort()
for i in range(q):
  flag = False
  for j in range(len(a)):
    if a[j] == bc[i][0]:
      a[j] = bc[i][1]
      flag = True
    else:
      if flag == True:
        break
  print(sum(a))
  a.sort()

  
  

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
Q = int(input())
BC = [list(map(int,input().split())) for _ in range(Q)]
count = [0]*((10**5)+100)
for i in range(len(A)):
  count[A[i]] += 1
sumA = sum(A)
for q in range(Q):
  count[BC[q][1]] += count[BC[q][0]]
  sumA += (BC[q][1] - BC[q][0])*count[BC[q][0]]
  print(sumA)
  count[BC[q][0]] = 0
### BUGGY CODE ###

# coding: UTF-8
n = int(raw_input())
value_list = []
for i in range(n):
    value_list.append(int(raw_input()))
    if i == 1:
        diff =value_list[1] - value_list[0]
    for j in range(i):
        diff2 = value_list[i] - value_list[j]
        if diff < diff2:
            diff = diff2
print diff




### FIXED CODE ###

from sys import stdin

N,*datas = [int(i) for i in stdin.readlines()]
now_max = max(datas[1:])
max_index = datas.index(now_max)
diff = now_max - datas[0]

for i in range(1,N-1):
    if i == max_index:
        now_max = max(datas[i+1:])
        max_index = datas.index(now_max,i+1)
    new_diff = now_max - datas[i]
    if diff < new_diff:
        diff = new_diff

print(diff)
### BUGGY CODE ###

def C(m):
    if xsort[m] > x[i]: 
        return True
    return False
 
 
n = int(input())
x = list(map(int, input().split()))

xsort = sorted(x)

for i in range(n):
    mb = 0
    lb = n
    m = (mb+lb) // 2
    for j in range(100):
        if C(m):
            lb = m
        else: 
            mb = m
    if mb < n//2:
        print(xsort[n//2])
    else:
        print(xsort[n//2-1])

### FIXED CODE ###

N = int(input())
X = list(map(int, input().split()))
Y = sorted(X)
m1 = Y[N//2]
m2 = Y[N//2-1]
 
for i in range(N):
    if m1 > X[i]:
        print(m1)  # left
    else:
        print(m2)  # right
### BUGGY CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
import math
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]

mod=10**9+7




pair_flg=0
set_flg=0
n=I()
A=LI()
t_set=set()
s_set=set(range(2,n+1))
D=defaultdict(set)

for j in range(n):
    a=A[j]
    prime_set = D[A[j]]
    flg=0
    if not prime_set:
        for i in range(2, int(a ** 0.5) + 1):
            while a % i == 0:
                prime_set.add(i)
                a //= i
            if D[a] or a == 1:
                prime_set |= D[a]
                break
        if a != 1:
            prime_set.add(a)
        D[A[j]]=prime_set
    if prime_set&t_set:
        pair_flg=1
    t_set|=prime_set
    s_set&=prime_set


if not pair_flg:
    print("pairwise coprime")
elif not s_set:
    print("setwise coprime")
else:
    print("not coprime")




### FIXED CODE ###

from collections import defaultdict, deque, Counter
from heapq import heappush, heappop, heapify
from math import gcd
import bisect
import random
from itertools import permutations, accumulate, combinations, product
import sys
import string
from bisect import bisect_left, bisect_right
from math import factorial, ceil, floor, gcd
from operator import mul
from functools import reduce


sys.setrecursionlimit(2147483647)
INF = 10 ** 13
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().rstrip().split()
def S(): return sys.stdin.readline().rstrip()
def IR(n): return [I() for i in range(n)]
def LIR(n): return [LI() for i in range(n)]
def SR(n): return [S() for i in range(n)]
def LSR(n): return [LS() for i in range(n)]
def SRL(n): return [list(S()) for i in range(n)]
def MSRL(n): return [[int(j) for j in list(S())] for i in range(n)]

mod=10**9+7

n=I()
A=LI()
l=A[0]
num=[0]*(10**6+1)
for i in range(1,n):
    num[A[i]]+=1
    l=gcd(l,A[i])



if l!=1:
    print("not coprime")
    exit()


for j in range(2,10**6):
    ret=0
    for k in range(j,10**6+1,j):
        ret+=num[k]
    if ret>1:
        print("setwise coprime")
        exit()

print("pairwise coprime")
### BUGGY CODE ###

from collections import Counter

input()
a = list(map(int, input().split()))
s = set(a)
t = {k for k, v in Counter(a).items() if v == 1} 
r = int(1 in t)
if 1 not in s:
  for x in t:
    i = 2
    while i * i <= x and (x % i or i not in s and x // i not in s):
      i += 1
    if i * i > x:
      r += 1
print(r)


### FIXED CODE ###

N = 1000001
a = [0]* N
input()
for x in input().split():
  a[int(x)] += 1
for i in range(1, N):
  for j in range(i + i, N, i):
    if a[i]:
      a[j] = 0
print(a.count(1))
### BUGGY CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = LI()
    r = [0] * 60
    t = [0] * 60
    u = [0] * 60
    ii = [2**i for i in range(60)]
    for k in a[::-1]:
        for i in range(60):
            if k & ii[i] > 0:
                r[i] += u[i]
                t[i] += 1
            else:
                r[i] += t[i]
                u[i] += 1

    rr = 0
    for i in range(60):
        rr += r[i] * ii[i]
        rr %= mod

    return rr


print(main())




### FIXED CODE ###

import math,string,itertools,fractions,heapq,collections,re,array,bisect,sys,copy,functools
import time,random

sys.setrecursionlimit(10**7)
inf = 10**20
eps = 1.0 / 10**10
mod = 10**9+7
dd = [(-1,0),(0,1),(1,0),(0,-1)]
ddn = [(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return list(map(int, sys.stdin.readline().split()))
def LLI(): return [list(map(int, l.split())) for l in sys.stdin.readlines()]
def LI_(): return [int(x)-1 for x in sys.stdin.readline().split()]
def LF(): return [float(x) for x in sys.stdin.readline().split()]
def LS(): return sys.stdin.readline().split()
def I(): return int(sys.stdin.readline())
def F(): return float(sys.stdin.readline())
def S(): return input()
def pf(s): return print(s, flush=True)
def pe(s): return print(str(s), file=sys.stderr)
def JA(a, sep): return sep.join(map(str, a))
def JAA(a, s, t): return s.join(t.join(map(str, b)) for b in a)


def main():
    n = I()
    a = LI()
    r = [0] * 60
    t = [0] * 60
    u = [0] * 60
    ii = [2**i for i in range(60)]
    for k in a[::-1]:
        for i in range(60):
            if k & ii[i] > 0:
                r[i] += u[i]
                t[i] += 1
            else:
                r[i] += t[i]
                u[i] += 1

    rr = 0
    for i in range(60):
        rr += r[i] * ii[i]
        rr %= mod

    return rr


print(main())
### BUGGY CODE ###

# DP(配るDP)
N, K = map(int, input().split())
h = list(map(int, input().split()))

dp = [float('inf')] * N
dp[0] = 0
for i in range(N - 1):
  for j in range(1, K + 1):
    if i + j > N - 1:
      break
    dp[i + j] = min(dp[i + j], dp[i] + abs(h[i + j] - h[i]))
print(dp[N -1])


### FIXED CODE ###

n, k = [int(e) for e in input().split()]
h = [int(e) for e in input().split()]
cost = [0] * n
cost[1] = abs(h[1] - h[0])
for i in range(1, n):
  cost[i] = min(abs(h[i] - h[j]) + cost[j] for j in range(max(0, i - k), i))
print(cost[n - 1])
### BUGGY CODE ###

# coding: utf-8
# Your code here!

def MI():return map(int,input().split())
def LI():return list(MI())

from collections import deque
n,m=MI()
G=[[] for i in range(n)]
# print(G)
for i in range(m):
    u,v=MI()
    G[u-1].append(v-1)

    
s,t=MI()
s=s-1
t=t-1


dq=deque([])

visited=[False]*n
dq.append(s)
depth=0
for i in range(1,10**6+1):
    par_list=[]
    while dq:
        try:
            p=dq.popleft()
            if visited[p]==True:
                continue
            else:
                visited[p]=True
                par_list.append(p)
        except:
            break
    depth+=1
    #print(depth)
    #print(par_list)
    if len(par_list)==0:
      break
    for par in par_list:
        for c1 in G[par]:
            for c2 in G[c1]:
                for c3 in G[c2]:
                    if c3==t:
                        #print(par,c1,c2,c3,"yay")
                        print(depth)
                        exit()
                    if visited[c3]==False:
                        dq.append(c3)
                        visited[c3]==True
    
                    #print(par,c1,c2,c3,end=" ")
                    #print()
    #print(i,len(dq),dq)
    
print(-1)


### FIXED CODE ###

from collections import deque
import sys
input = sys.stdin.readline
def MI():return map(int,input().split())
def main():
  n,m=MI()
  G=[[] for _ in range(n)]
  for _ in range(m):
    u,v=MI()
    u-=1
    v-=1
    G[u].append(v)
  s,t=MI()
  s-=1
  t-=1
  
  fi=[True]*n
  se=[True]*n
  th=[True]*n
  th[s]=False
  
  dq=deque([])
  dq.append(s)
  depth=0
  
  while dq:
    depth+=1
    tank1=[]
    tank2=[]
    tank3=[]
    
    for p in dq:
      for c in G[p]:
        if fi[c]:
          fi[c]=False
          tank2.append(c)
    for p in tank2:
      for c in G[p]:
        if se[c]:
          se[c]=False
          tank3.append(c)
    for p in tank3:
      for c in G[p]:
        if th[c]:
          th[c]=False
          tank1.append(c)
        if c==t:
          print(depth)
          exit()
    dq=deque(tank1)
  print(-1)  
if __name__=='__main__':
  main()
### BUGGY CODE ###

n=int(input())
a=list(map(int, input().split()))
count=0
for i in range(1,n+1):
    for j in range (len(a)):
        if a[j] == i:
            count += 1
    else:
        print(count)
        count = 0

### FIXED CODE ###

import collections
n=int(input())
a=list(map(int, input().split()))
ct=collections.Counter(a)
for i in range(n):
    print(ct[i+1])
### BUGGY CODE ###

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

ans = 0
numcnt = [0]*100001

for i in a:
    numcnt[i]+=1
    
for x in range(max(a)+1):
    dx = [-1,0,1]
    subans = 0
    for i in dx:
        if x+i<0 or x+i>max(a):
            continue
        subans += numcnt[x+i]
        
    ans = max(ans,subans)
    
print(ans)

### FIXED CODE ###

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

ans = 0
numcnt = {i:0 for i in range(100001)}

for i in a:
    numcnt[i]+=1
    
for x in range(1,100000):
    subans = numcnt[x-1]+numcnt[x]+numcnt[x+1]
        
    ans = max(ans,subans)
    
print(ans)
### BUGGY CODE ###

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

count = n
for j in range(n-1):
    xor = [0 for i in range(n)]
    sum = [0 for i in range(n)]
    xor[j] = a[j]
    sum[j] = a[j]
    for i in range(j+1, n):
        xor[i] = xor[i - 1] ^ a[i]
        sum[i] = sum[i-1] + a[i]
        if xor[i] == sum[i]:
            count += 1
print(count)


### FIXED CODE ###

def evaluate(digit):
    _digit = str(format(digit, "b"))
    print(_digit)
    for i in range(len(_digit)):
        if int(_digit[i]) > 1:
            return False
    return True

def func(n, a):
    digit = 0
    count = 0
    i = 0
    j = 0
    while j < n:
        while j < n:
            if digit ^ a[j] == digit + a[j]:
                digit += a[j]
                count += j - i + 1
                # print("j i:{} j:{} count:{} digit:{}".format(i, j, count, format(digit, "b")))
                j += 1
            else:
                break
        while i < j < n:
            digit ^= a[i]
            i += 1
            break
        # print("_ i:{} j:{} count:{} digit:{}".format(i, j, count, format(digit, "b")))
    return count
"""
print(func(4, [2, 5, 4, 6]))
print(func(9, [0, 0, 0, 0, 0, 0, 0, 0, 0]))
print(func(19,[885, 8, 1, 128, 83, 32, 256, 206, 639, 16, 4, 128, 689, 32, 8, 64, 885, 969, 1]))
"""
digit = 0
n = int(input())
a = [int(i) for i in input().split()]
print(func(n, a))
### BUGGY CODE ###

"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

import sys
sys.setrecursionlimit(10**6)
input = lambda: sys.stdin.readline().rstrip()
inf = float("inf") # 無限

n = int(input())
a = list(map(int,input().split()))
num = 1
for x in a[:]:
    num*=x
    if num == 0:
        break
if 10**18<num:
    num = -1
print(num)

### FIXED CODE ###

"""
N = list(map(int,input().split()))
S = [str(input()) for _ in range(N)]
S = [list(map(int,list(input()))) for _ in range(h)] 
print(*S,sep="")
"""

n = int(input())
a = list(map(int,input().split()))
if 0 in a:
    print("0")
else:
    num = 1
    for x in range(n):
        num *= a[x]
        if 10**18 < num:
            num = -1
            break

    print(num)
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

t = input().rstrip()
list_t = []

for s in t:
    list_t.append(s)

ans_str = ""
for i, s in enumerate(list_t):
    if s == "?":
        list_t[i] = "D"
    ans_str += list_t[i]

print(ans_str)




### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-

t = input().rstrip()
list_t = []

for s in t:
    list_t.append(s)

ans_str = ""
for i, s in enumerate(list_t):
    if s == "?":
        list_t[i] = "D"

print("".join(list_t))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

n, m = map(int, input().split())

graph = [[] for _ in range(n + 1)]

for i in range(m):
    f, t = map(int, input().split())
    graph[t].append(f)

dp = [None] * (n + 1)
def dfs(now):
    if dp[now] is not None:
        return dp[now]

    if not graph[now]:
        return 0

    return max(dfs(parent) for parent in graph[now]) + 1

print(max(dfs(i) for i in range(1, n + 1)))


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 6)

n, m = map(int, input().split())

graph = [[] for _ in range(n + 1)]

for i in range(m):
    f, t = map(int, input().split())
    graph[t].append(f)

dp = [-1] * (n + 1)
def dfs(now):
    if dp[now] != -1:
        return dp[now]

    if not graph[now]:
        return 0

    r = max(dfs(parent) for parent in graph[now]) + 1
    dp[now] = r
    return r

print(max(dfs(i) for i in range(1, n + 1)))
### BUGGY CODE ###

s=input()

n=len(s)

x=[1]*n
z=[]
st=0
en=0
bk=0

for i in range(10**100):
	y=[0]*n
	for j in range(n):
		if s[j]=='R':
			y[j+1]+=x[j]       
		else:
			y[j-1]+=x[j]
	x=y
	z.append(y)
	if i>0:
		for k in range(i-1):
			if z[i]==z[k]:
				st=k
				en=i
				bk=1
				break
	if bk==1:
		break

cy=en-st
po=(10*100-(st+1))%cy
res=z[st+po]

print(*res)

### FIXED CODE ###

s=input()

n=len(s)
x=[1]*n
x[n-1]=0
y=[1]*n
y[0]=0
z=[0]*n

for i in range(0,n-1):
	if s[i]=='R' and s[i+1]=='R':
		x[i+1]+=x[i]
		x[i]=0
	if s[i]=='L':
		x[i]=0   

for i in range(n-1,0,-1):
	if s[i]=='L' and s[i-1]=='L':
		y[i-1]+=y[i]
		y[i]=0
	if s[i]=='R':
		y[i]=0

i=1
while i<=n-2:
	if x[i]>1:
		if x[i]%2==0:
			x[i]=x[i]//2
			x[i+1]=x[i]
		else:
			x[i]=x[i]//2+1
			x[i+1]=x[i]-1
		i+=1
	i+=1
        
i=n-2
while i>=1:
	if y[i]>1:
		if y[i]%2==0:
			y[i]=y[i]//2
			y[i-1]=y[i]
		else:
			y[i]=y[i]//2+1
			y[i-1]=y[i]-1
		i-=1
	i-=1

for i in range(n):
	z[i]=x[i]+y[i]

print(*z)
### BUGGY CODE ###

N = int(input())
As = list(map(int,input().split()))
MOD = 7+10**9
ans = 0
for i in range(N-1): ans = (ans+As[i]*sum(As[i+1:]))%MOD
print(ans)

### FIXED CODE ###

N = int(input())
As = list(map(int,input().split()))
MOD = 7+10**9
ans = 0
Asum = sum(As)
for i in range(N-1):
  Asum -= As[i]
  ans = (ans+As[i]*Asum)%MOD
print(ans)
### BUGGY CODE ###

n, w = map(int, input().split())

dp = [0] * (w + 1)

for _ in range(n):
    wi, vi = map(int, input().split())

    for wj in range(w, wi - 1, -1):
        nv = dp[wj - wi] + vi
        if dp[wj] < nv:
            dp[wj] = nv

print(max(dp))


### FIXED CODE ###

import sys
input = sys.stdin.readline

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

    dp = [0] * (w + 1)

    for _ in range(n):
        wi, vi = map(int, input().split())

        for wj in range(w, wi - 1, -1):
            nv = dp[wj - wi] + vi
            if dp[wj] < nv:
                dp[wj] = nv

    print(max(dp))

main()
### BUGGY CODE ###

n = int(input())
nums = [int(i) for i in input().split()]
mod = 10 ** 9 + 7

def gcd(x, y): #GCD
    # greatest_common_divisor
    if x < y:
        x, y = y, x
    if y == 0:
        return 0
    if x % y == 0:
        return y
    return gcd(y, x % y)

def lcm(x, y): #LCM
    # lowest_common_multiple
    return x * y // gcd(x, y)

LCM = 1
for num in nums:
    LCM = lcm(num, LCM)

# ans = 0
# for num in nums:
#     ans += (LCM // num) % mod
# print(ans % mod)
ans = 0
for num in nums:
    ans += LCM * pow(num, mod - 2, mod) % mod


print(ans % mod)

### FIXED CODE ###

mod=10**9+7
n=int(input())
a=list(map(int,input().split()))
def gcd(a,b):
  while b:a,b=b,a%b
  return a
def lcm(a,b):return a*b//gcd(a,b)
l=a[0]
for i in range(1,n):
  l=lcm(l,a[i])
ans=0
l%=mod
for i in range(n):
  ans+=l*pow(a[i],mod-2,mod)
  ans%=mod
print(ans)
### BUGGY CODE ###

from operator import itemgetter

n, m = [int(i) for i in input().split()]
a = sorted([int(i) for i in input().split()])
#print(a)

bc = []
for _ in range(m):
  bc.append([int(i) for i in input().split()])
bc = sorted(bc, key=itemgetter(1), reverse=True)
#print(bc)

ans = 0
for b,c in bc:
  #print(a,b,c)
  lower_c_num = 0
  for a_i in a:
    if a_i < c:
      lower_c_num += 1
      if lower_c_num > b:
        lower_c_num = b
        break
    else:
      break
    
  change = min(b, lower_c_num)
  a = a[change:]
  ans += c * change
  if len(a) == 0:
    break
  if change != b:
    break
    
ans += sum(a)

print(ans)
    

### FIXED CODE ###

from operator import itemgetter

n, m = [int(i) for i in input().split()]
a = sorted([int(i) for i in input().split()])
#print(a)

bc = []
for _ in range(m):
  bc.append([int(i) for i in input().split()])
bc = sorted(bc, key=itemgetter(1), reverse=True)
#print(bc)

change = []
for b,c in bc:
  len_change = len(change)
  b_up = b
  if n - len_change < b:
    b_up = n - len_change
  #print(b_up)
  change += [c]*b_up
  if b_up != b:
    break
change += [0]*(n-len(change))

ans = 0
for i in range(n):
  #print(ans)
  #print(i)
  if a[i] < change[i]:
    ans += change[i]
  else:
    ans += sum(a[i:])
    break
    
print(ans)
### BUGGY CODE ###

S = input()
p = 10 ** 9 + 7
DP = [[0 for j in range(4)] for i in range(len(S) + 1)]
DP[len(S)][3] = 1
for i in range(len(S) - 1, -1, -1):
  for j in range(3, -1, -1):
    if j == 3:
      DP[i][j] = DP[i + 1][3] * (3 if S[i] == '?' else 1) % p
    else:
      DP[i][j] += DP[i + 1][j + 1] * (1 if S[i] == chr(65 + j) or S[i] == '?' else 0)
      DP[i][j] += DP[i + 1][j] * (3 if S[i] == '?' else 1)
      DP[i][j] % p
print(DP[0][0] % p)

### FIXED CODE ###

S = input()
p = 10 ** 9 + 7
DP = [0, 0, 0, 1]
dp = [0] * 4
for i in range(len(S) - 1, -1, -1):
  for j in range(3, -1, -1):
    if j == 3:
      dp[j] = DP[3] * (3 if S[i] == '?' else 1) % p
    elif S[i] == '?':
      dp[j] = (3 * DP[j] + DP[j + 1]) % p
    elif S[i] == chr(65 + j):
      dp[j] = (DP[j] + DP[j + 1]) % p
    else:
      dp[j] = DP[j]
  DP = [x for x in dp]
print(DP[0] % p)
### BUGGY CODE ###

"""
k=int(input())
a=list(map(int,input().split()))
if k==1:
    print(0)
else:
    dp = [0] * k
    dp[1] = abs(a[0]-a[1])
    for i in range(2,k):
        dp[i]=min(
            dp[i-1]+abs(a[i]-a[i-1]),
            dp[i-2]+abs(a[i]-a[i-2])
        )
    print(dp[-1])
"""
from collections import deque
n=int(input())
cost=list(map(int,input().split()))
if n==1:
    print(0)
else:
    # if we reach early step faster then terminate which makes more sense
    ways = [1, 2]
    ways.sort(reverse=True)
    q = deque([(0, 0)])  # path,cost
    min_cost = float('inf')
    explore_more = 1
    while q:
        # print(q)
        for _ in range(len(q)):
            path, cost_ = q.popleft()
            if path == n - 1:
                min_cost = min(min_cost, cost_)
                explore_more = 0
            if explore_more:
                for way in ways:
                    if path + way < n:
                        q.append((path + way, cost_ + abs(cost[path] - cost[path + way])))

    print(min_cost)




### FIXED CODE ###

k=int(input())
a=list(map(int,input().split()))
if k==1:
    print(0)
else:
    dp = [0] * k
    dp[1] = abs(a[0]-a[1])
    for i in range(2,k):
        dp[i]=min(
            dp[i-1]+abs(a[i]-a[i-1]),
            dp[i-2]+abs(a[i]-a[i-2])
        )
    print(dp[-1])
### BUGGY CODE ###

import math

N = int(input().split()[0])

n_list = [i for i in range(1, N+1)]
p_list = n_list[1:] + [1]

ans_1 = sum(n_list[:-1])
if (N - 1) % 2 == 0:
    ans = int(N * ((N - 1) / 2))
else:
    mean_v = math.floor((N - 1) / 2) + 1
    ans = int(N * math.floor((N - 1) / 2))
    ans += mean_v

print(ans)


### FIXED CODE ###

import math

N = int(input().split()[0])

# if (N - 1) % 2 == 0:
#     ans = int(N * ((N - 1) / 2))
# else:
#     mean_v = math.floor((N - 1) / 2) + 1
#     ans = int(N * math.floor((N - 1) / 2))
#     ans += mean_v

ans = N * (N-1) // 2

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

n=int(input())

a = list(input().split())
a = [int(i) for i in a]
ans=1

if len(a) % 2 == 1: 
  for i in range(1, int(len(a)/2)+2):
    if i == int(len(a)/i) + 1:
      ans = ans*a[i-1]
    else:
      ans = ans*a[i-1]*a[-1*i]
else:
  for i in range(0, int(len(a)/2)):
    ans = ans*a[i]*a[-1 - i]

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

### FIXED CODE ###

n=int(input())

a = list(input().split())
a = [int(i) for i in a]
ans=1


if 0 in a:
  pass

elif len(a) % 2 == 1: 
  for i in range(1, int(len(a)/2)+2):
    #print(ans)
    if ans > 10**18 or ans == 0:
      break
    if i == int(len(a)/2) + 1:
      ans = ans*a[i-1]
    else:
      ans = ans*a[i-1]*a[-1*i]
    
else:
  for i in range(0, int(len(a)/2)):
    if ans > 10**18 or ans == 0:
      break
    ans = ans*a[i]*a[-1 - i]
    

if ans > 10**18:
  print('-1')
elif 0 in a:
  print(0)
else:
  print(ans)
### BUGGY CODE ###

import heapq

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

A_heap = A[:]
heapq.heapify(A_heap)

ans = []
for i in range(N):
    ans.append(A.index(heapq.heappop(A_heap)) + 1)
print(*ans)

### FIXED CODE ###

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

ans = [0] * N
for i in range(N):
    ans[A[i]-1] = i+1
print(*ans)