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

N = int(input())
Ass = [tuple(map(lambda x: int(x)-1, input().split())) for _ in range(N)]

games = []
for i in range(N):
    for j in range(i+1, N):
        games.append((i, j))
adjL = dict([(game, []) for game in games])

indegs = dict([(game, 0) for game in games])
for i, As in enumerate(Ass):
    for j in range(len(As)-1):
        p1, p2, p3, p4 = i, As[j], i, As[j+1]
        if p1 > p2:
            p1, p2 = p2, p1
        if p3 > p4:
            p3, p4 = p4, p3
        adjL[(p1, p2)].append((p3, p4))
        indegs[(p3, p4)] += 1

gameTodays = set()
for game in games:
    if indegs[game] == 0:
        gameTodays.add(game)

ans = 0
numDone = 0
while gameTodays:
    gameTomorrows = set()
    for game in gameTodays:
        numDone += 1
        for game2 in adjL[game]:
            indegs[game2] -= 1
            if indegs[game2] == 0:
                gameTomorrows.add(game2)
    ans += 1
    gameTodays = gameTomorrows

if numDone == N*(N-1)//2:
    print(ans)
else:
    print(-1)


### FIXED CODE ###

def solve():
    N = int(input())
    Ass = []
    for _ in range(N):
        As = list(map(lambda x: int(x)-1, input().split()))
        Ass.append(As+[N])

    games = []
    numReadyss = [[0]*(N) for _ in range(N)]
    iAs = [0] * N
    for i in range(N):
        j = Ass[i][iAs[i]]
        if j > i: i, j = j, i
        numReadyss[i][j] += 1
        if numReadyss[i][j] >= 2:
            games.append((i, j))
    ans = 1
    numOK = 0
    while True:
        if not games:
            print(-1)
            return
        game2s = []
        for i, j in games:
            iAs[i] += 1
            i2 = Ass[i][iAs[i]]
            if i2 == N:
                numOK += 1
            else:
                if i2 > i: i, i2 = i2, i
                numReadyss[i][i2] += 1
                if numReadyss[i][i2] >= 2:
                    game2s.append((i, i2))
            iAs[j] += 1
            j2 = Ass[j][iAs[j]]
            if j2 == N:
                numOK += 1
            else:
                if j2 > j: j, j2 = j2, j
                numReadyss[j][j2] += 1
                if numReadyss[j][j2] >= 2:
                    game2s.append((j, j2))
        if numOK >= N:
            print(ans)
            return
        ans += 1
        games = game2s


solve()
### BUGGY CODE ###

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

for i in range(M):
  B, C = map(int, input().split())
  if min(A) < C:
    for j in range(B):
      if A[j] < C:
        A[j] = C
      else:
        break
    A.sort()

print(sum(A))

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
BC = [list(map(int, input().split())) for _ in range(M)]
lenA = len(A)
minA = min(A)
BC.sort(reverse = True, key = lambda x:x[1])

i = 0
cnt = 0
while cnt < lenA and i < M:
  A.extend([BC[i][1] for _ in range(BC[i][0])])
  cnt += BC[i][0]
  i += 1
A.sort(reverse = True)
l = A[0:lenA]

print(sum(l))
### BUGGY CODE ###

import sys
input = sys.stdin.readline

# C - management
N = int(input())
A = list(map(int, input().split()))

for i in range(1, N + 1):
	print(A.count(i))

### FIXED CODE ###

import sys
input = sys.stdin.readline

# C - management
N = int(input())
A = list(map(int, input().split()))
dic = dict()

for i in range(1, N + 1):
	dic[i] = 0

for a in A:
	dic[a] += 1

for v in dic.values():
	print(v)
### BUGGY CODE ###

from collections import deque


def find_black():
    for y in range(H):
        for x in range(W):
            if canvas[y][x] == "#" and first_visit[y][x]:
                que.append((y, x))
                first_visit[y][x] = False


dir_y = [1, 0, -1, 0]
dir_x = [0, 1, 0, -1]
def paint_canvas_black():
    while len(que) > 0:
        y, x = que.popleft()
        for i in range(4):
            next_y = y + dir_y[i]
            next_x = x + dir_x[i]
            if 0 <= next_y < H and 0 <= next_x < W and canvas[next_y][next_x] == ".":
                canvas[next_y][next_x] = "#"


def has_painted():
    return canvas == BLACK_CANVAS


H, W = map(int, input().split())
sy, sx = -1, -1
canvas = []
BLACK_CANVAS = [["#"]*W for _ in range(H)]
first_visit = [[True]*W for _ in range(H)]
for y in range(H):
    canvas.append(list(input()))
    if sy == sx == -1:
        for x in range(W):
            if canvas[y][x] == "#":
                sy, sx = y, x
                break


que = deque()
count = 0
while not has_painted():
    find_black()
    paint_canvas_black()
    count += 1

print(count)

### FIXED CODE ###

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

has_visited = [[True]*(W+2)]
has_visited += [[True] + [m == "#" for m in input().rstrip()] + [True] for _ in range(H)]
has_visited += [[True]*(W+2)]

search_que = []
for y in range(1, H+1):
    for x in range(1, W+1):
        if has_visited[y][x]:
            search_que.append((y, x))

count = -1
while search_que:
    count += 1
    next_que = []
    for y, x in search_que:
        if not has_visited[y+1][x]:
            has_visited[y+1][x] = True
            next_que.append((y+1, x))
        if not has_visited[y-1][x]:
            has_visited[y-1][x] = True
            next_que.append((y-1, x))
        if not has_visited[y][x+1]:
            has_visited[y][x+1] = True
            next_que.append((y, x+1))
        if not has_visited[y][x-1]:
            has_visited[y][x-1] = True
            next_que.append((y, x-1))
    search_que = next_que

print(count)
### BUGGY CODE ###

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

while True:
    #すべてが偶数か確認
    for i in range(N):
        if A[i] % 2 == 0:
            continue
        else:
            break 

    for i in range(N):
        A[i] = A[i]/2
    n += 1


print(n)

### FIXED CODE ###

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

while 1:
    #すべてが偶数か確認
    for i in range(N):
        if A[i] % 2 == 0:
            continue
        else:
            F = 1
    
    if F == 1 : break 

    for i in range(N):
        A[i] = A[i]/2
    n += 1


print(n)
### BUGGY CODE ###

n,m=map(int,input().split())
h_list=list(map(int,input().split()))
col_list=[[0]*n for _ in range(n)]
count=0
for _ in range(m):
  a,b=map(int,input().split())
  col_list[a-1][b-1]+=1
  col_list[b-1][a-1]+=1
for i in range(n):
  for j in range(n):
    if col_list[i][j]>=1 and h_list[i]<=h_list[j]:
      count+=1
      break
print(n-count)


### FIXED CODE ###

n,m=map(int,input().split())
h_list=list(map(int,input().split()))
lst=[0]*n
for _ in range(m):
  a,b=map(int,input().split())
  if h_list[a-1]<=h_list[b-1]:
    lst[a-1]-=1
  if h_list[a-1]>=h_list[b-1]:
    lst[b-1]-=1
print(lst.count(0))
### BUGGY CODE ###

S = input()
a = 0
b = 0
c = 0
p = 1
mod = 1000000000+7
for C in S:
    if C == "?":
        c = 3*c+b
        b = 3*b+a
        a = 3*a+p
        p *= 3
        a %= mod
        b %= mod
        c %= mod
    elif C == "A":
        a += p
        a %= mod
    elif C == "B":
        b += a
        b %= mod
    elif C == "C":
        c += b
        c %= mod
print(c)

### FIXED CODE ###

S = input()
a = 0
b = 0
c = 0
p = 1
mod = 1000000000+7
for C in S:
    if C == "?":
        c = 3*c+b
        b = 3*b+a
        a = 3*a+p
        p *= 3
    elif C == "A":
        a += p
    elif C == "B":
        b += a
    elif C == "C":
        c += b
    a %= mod
    b %= mod
    c %= mod
    p %= mod
print(c)
### BUGGY CODE ###

N = int(input())
S = list(input())
r = []
g = []
b = []
s = len(S)
for i in range(s):
    if S[i] == 'R':
        r.append(i)
    elif S[i] == 'G':
        g.append(i)
    else:
        b.append(i)
lr = len(r)
lg = len(g)
lb = len(b)
cnt = lr * lg * lb
for i in range(lr):
    for j in range(lg):
        r0 = r[i]
        g0 = g[j]
        up = max(r0,g0)+abs(r0-g0)
        dw = min(r0,g0)-abs(r0-g0)
        if up < s and S[up] == 'B':
            cnt -= 1
        if dw >= 0 and S[dw] == 'B':
            cnt -= 1
        if abs(r0-g0)%2 == 0:
            half = min(r0,g0) + abs(r0-g0)//2
            if 0 <= half < s and S[half] == 'B':
                cnt -= 1
print(cnt)

### FIXED CODE ###

N = int(input())
S = list(input())
r = []
g = []
b = []
s = len(S)
for i in range(s):
    if S[i] == 'R':
        r.append(i)
    elif S[i] == 'G':
        g.append(i)
    else:
        b.append(i)
lr = len(r)
lg = len(g)
lb = len(b)
cnt = lr * lg * lb
for i in range(lr):
    for j in range(lg):
        r0 = r[i]
        g0 = g[j]
        up = max(r0,g0)+abs(r0-g0)
        dw = min(r0,g0)-abs(r0-g0)
        if up < s and S[up] == 'B':
            cnt -= 1
        if dw >= 0 and S[dw] == 'B':
            cnt -= 1
        if abs(r0-g0)%2 == 0:
            half = min(r0,g0) + abs(r0-g0)//2
            if 0 <= half < s and S[half] == 'B':
                cnt -= 1
print(cnt)
### BUGGY CODE ###

H,W,D=map(int,input().split())
A=[]
for _ in range(H):
    A.append(list(map(int,input().split())))
Q=int(input())

dic=dict()
from itertools import product
for i,j in product(range(H),range(W)):
    dic[A[i][j]]=(i,j)

for _ in range(Q):
    ans=0
    L,R=map(int,input().split())
    i,j=dic[L]
    for k in range((R-L)//D):
        x,y=dic[L+D*(k+1)]
        ans+=abs(x-i)+abs(y-j)
        i,j=(x,y)
    print(ans)


### FIXED CODE ###

H,W,D=map(int,input().split())
dic=dict()
for i in range(H):
    A = list(map(int,input().split()))
    for j in range(W):
        dic[A[j]]=(i,j)

Q=int(input())

d=[0 for i in range(H*W+1)]

for i in range(D+1,H*W+1):
    p,q = dic[i-D]
    x,y = dic[i]
    d[i]=d[i-D]+abs(p-x)+abs(q-y)


for _ in range(Q):
    ans=0
    L,R=map(int,input().split())
    print(d[R]-d[L])
### BUGGY CODE ###

N = int(input())

saved = []
cnt_ls = []
saved_ap = saved.append
cnt_ap = cnt_ls.append

for i in range(N):
    s = "".join(sorted(input()))
    if s not in saved:
        saved_ap(s)
        cnt_ap(1)
    else:
        cnt_ls[saved.index(s)] += 1

result = 0

for i in range(len(cnt_ls)):
    tmp = cnt_ls[i]
    result += int( tmp * (tmp - 1) / 2 )

print(result)



### FIXED CODE ###

from collections import Counter

N = int(input())

s = []
s_ap = s.append

for i in range(N):
    s_ap("".join(sorted(input())))

result = 0

for i in Counter(s).values():
    if not i == 1:
        result += int(i * (i - 1) / 2)
        
print(result)
### BUGGY CODE ###

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

row = [[[-1,-1] for i in range(w)] for j in range(h)]
col = [[[-1,-1] for i in range(w)] for j in range(h)]

for i in range(h):
    tmp = input()
    count_l = 0
    count_r = 0
    for j in range(w):
        if tmp[j] == ".":
            row[i][j][0] = count_l
            count_l += 1
        else:
            count_l = 0
        if tmp[w-1-j] == ".":
            row[i][w-1-j][1] = count_r
            count_r += 1
        else:
            count_r = 0

for j in range(w):
    count_u = 0
    count_d = 0
    for i in range(h):
        if row[i][j][0] >= 0:
            col[i][j][0] = count_u
            count_u += 1
        else:
            count_u = 0
        if row[h-1-i][j][0] >= 0:
            col[h-1-i][j][1] = count_d
            count_d += 1
        else:
            count_d = 0

ans = 0
for i in range(h):
    for j in range(w):
        ans = max(ans, row[i][j][0] + row[i][j][1] + col[i][j][0] + col[i][j][1] + 1)

print(ans)


### FIXED CODE ###

import numpy as np

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

up = np.zeros((h, w), dtype=int)
down = np.zeros((h, w), dtype=int)
right = np.zeros((h, w), dtype=int)
left = np.zeros((h, w), dtype=int)

map = np.array([list(input()) for i in range(h)]) == "."

for i in range(1, h):
    up[i] = (up[i-1] + 1) * map[i-1]
    down[h-1-i] = (down[h-i] + 1) * map[h-i]
for j in range(1, w):
    left[:,j] = (left[:,j-1] + 1) * map[:,j-1]
    right[:,w-1-j] = (right[:,w-j] + 1) * map[:,w-j]

print(((up+down+right+left+1) * map).max())
### BUGGY CODE ###

n = int(input())
s = input()

ans = 0
for j in range(n):
    for i in range(j):
        temp = 0
        mar = 0
        while (j + mar < n) & (i + mar < j):
            if (s[j+mar] == s[i+mar]):
                mar += 1
                temp += 1
            else:
                break
        ans = max(ans, temp)
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
i = 0
j = 0
r = 0
while i < n:
    if s[i:j] in s[j:]:
        r = max(r, j - i)
        j += 1
    else:
        i += 1
print(r)
### BUGGY CODE ###

import math
import re
T=input()
x=0
Td=T
d = len(re.sub(r'0', '', Td))
x += math.ceil((d/2+1)*d/2)
spT = T.split('0')
lenT = list(map(len, spT))

tmpX = math.ceil(d/2)
bT = 0
aT = d
tmp = ''
for i in range(len(spT) - 1):
    tmp += spT[i]
    bT += lenT[i]
    aT -= lenT[i]
    if bT % 2==1:
        bT += 1
        if aT % 2 ==1:
            tmpX += 1
        x += tmpX
        tmp += '0'
    else:
        tmp +='+'
tmp += spT[-1]

spT = tmp.split('+')
vT =[]
aT = bT
bT = 0
odT = 0
tmpOd = True
for i in range(len(spT)):
    
    od = len(re.sub(r'0', '', spT[i][0 if tmpOd else 1::2]))
    ev = len(re.sub(r'0', '', spT[i][1 if tmpOd else 0::2]))
    odT += od
    vT.append(od - ev)
    if len(spT[i]) %2 == 1:
        tmpOd = not tmpOd

while len(vT) >1:
    odT = odT - vT[-1]
    x += odT
    vT[-2] = vT[-2] - vT[-1]
    vT = vT[:-1]

print(x)

### FIXED CODE ###

import math
import re
T=input()
x=0
Td=T
d = len(re.sub(r'0', '', Td))
x += math.ceil((d/2+1)*d/2)
spT = T.split('0')
lenT = list(map(len, spT))

tmpX = math.ceil(d/2)
bT = 0
aT = d
tmp = ''
for i in range(len(spT) - 1):
    tmp += spT[i]
    bT += lenT[i]
    aT -= lenT[i]
    if bT % 2==1:
        bT += 1
        if aT % 2 ==1:
            tmpX += 1
        x += tmpX
        tmp += '0'
    else:
        tmp +='+'
tmp += spT[-1]

spT = tmp.split('+')
vT =[]
aT = bT
bT = 0

odT = 0
tmpOd = True

for i in range(len(spT)):
    
    od = len(re.sub(r'0', '', spT[i][0 if tmpOd else 1::2]))
    ev = len(re.sub(r'0', '', spT[i][1 if tmpOd else 0::2]))
    odT += od
    vT.append(od - ev)
    if len(spT[i]) %2 == 1:
        tmpOd = not tmpOd

for i in reversed(range(1, len(spT))):
    odT = odT - vT[i]
    x += odT
    vT[i-1] -= vT[i]


print(x)
### BUGGY CODE ###

# -*- coding utf-8 -*-

N, M = map(int, input().split())
bridge_m = [set(map(int, input().split())) for _ in range(M)]
bridge_m.append(set())
# print(bridge_m)

def conb2(x):
    return int(x * (x - 1)/2) if x > 1 else 0

sets = []
ans = conb2(N)
ans_list = []
for i in range(M, 0, -1):
    joint_sets = []
    bi = bridge_m[i]
    for s in sets:
        if not s.isdisjoint(bi):
            joint_sets.append(s)

    if len(joint_sets) == 0:
        sets.append(bi)
    else:
        new_set = set()
        new_set = new_set.union(bi)
        for js in joint_sets:
            new_set = new_set.union(js)
            sets.remove(js)
        sets.append(new_set)
    # print('joint_sets', joint_sets)
    # print('sets', sets)

    # calc ans
    ans = conb2(N)
    for s in sets:
        ans -= conb2(len(s))
    # print(ans)
    ans_list.append(ans)
for i in range(M - 1, -1, -1):
    print(ans_list[i])

    

### FIXED CODE ###

# -*- coding utf-8 -*-

N, M = map(int, input().split())
bridge_m = [list(map(int, input().split())) for _ in range(M)]
# print(bridge_m)

class UnionFind():
    def __init__(self, n):
        self.node = [-1] * n
    
    def is_root(self, nid):
        return self.node[nid] < 0

    def find(self, nid):
        # find group id
        if self.is_root(nid):
            return nid
        else:
            self.node[nid] = self.find(self.node[nid])
            return self.node[nid]

    def is_same_group(self, nid1, nid2):
        return self.find(nid1) == self.find(nid2)

    def size(self, nid):
        return - self.node[self.find(nid)]

    def union(self, nid1, nid2):
        if self.is_same_group(nid1, nid2):
            return

        g1 = self.find(nid1)
        g2 = self.find(nid2)
        if self.size(g1) < self.size(g2):
            self.node[g2] -= self.size(g1)
            self.node[g1] = g2
        else:
            self.node[g1] -= self.size(g2)
            self.node[g2] = g1

uf = UnionFind(N + 1)
ans = [0] * M
ans[M - 1] = int(N * (N - 1) / 2)
g_num = 0
for i in range(M - 1, 0, -1):
    a = bridge_m[i][0]
    b = bridge_m[i][1]

    if uf.is_same_group(a, b):
        ans[i - 1] = ans[i]
    else:
        ans[i - 1] = ans[i] - uf.size(a) * uf.size(b)
        uf.union(a, b)

for i in range(M):
    print(ans[i])
### BUGGY CODE ###

import numpy as np

h,w,d = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(h)]
q = int(input())
b = [list(map(int,input().split())) for _ in range(q)]
p =[0]*h*w
    
for i in range(h):
    for j in range(w):
        tmp = a[i][j]
        p[tmp-1] = [i,j]

def power(x,y):
    return abs(p[x-1][0]-p[y-1][0])+abs(p[x-1][1]-p[y-1][1])

for k in range(q):
    ans = 0
    l = b[k][0]
    r = b[k][1]
    while l < r:
        ans += power(l,l+d)
        l += d
    print(ans)

### FIXED CODE ###

import numpy as np

h,w,d = map(int,input().split())
a = [list(map(int,input().split())) for _ in range(h)]
q = int(input())
b = [list(map(int,input().split())) for _ in range(q)]
p =[0]*(h*w+1)
    
for i in range(h):
    for j in range(w):
        tmp = a[i][j]
        p[tmp] = [i,j]
cost = [0]*(h*w+1)
i = d+1
while i <= h*w:
    cost[i] = cost[i-d] + abs(p[i][0]-p[i-d][0]) + abs(p[i][1]-p[i-d][1])
    i += 1
for k in range(q):
    r = b[k][0]
    l = b[k][1]
    print(cost[l]-cost[r])
### BUGGY CODE ###

import numpy as np
n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)]

ex = [[1,2], [0,2], [0,1]]
dp = np.array([abc[0]] + [[0]*3 for _ in range(n-1)])

for i in range(n-1):
    for j in range(3):
        dp[i+1][j] = abc[i+1][j] + max(np.take(dp[i], ex[j]))

print(max(dp[-1]))

### FIXED CODE ###

n = int(input())
abc = [list(map(int, input().split())) for _ in range(n)]
dp = [[0,0,0] for _ in range(n)]

dp[0] = abc[0]
ls = [[1,2], [0,2], [0,1]]

if n == 1:
    ans = min(dp[0])
else:
    for i in range(1,n):
        for j in range(3):
            dp[i][j] = max([ dp[i-1][k] for k in ls[j] ]) + abc[i][j]

print(max(dp[-1]))
### BUGGY CODE ###

import numpy as np
sitei = input().split()
H, W, D = int(sitei[0]), int(sitei[1]), int(sitei[2])
_masume = np.zeros([H, W])
for i in range(H):
    _masume[i] = np.array(input().split())
masume = _masume.astype(int)

Q = int(input())

_settei = np.zeros([Q, 2])

for i in range(Q):
    _settei[i] = np.array(input().split())

settei = _settei.astype(int)
maryoku = 0

zahyou = [np.where(masume==l) for l in range(1, H*W+1)]

for l in range(Q):
    if settei[l][0] == settei[l][1]:
        print(maryoku)
        continue
    atai = settei[l][0]
    while (atai != settei[l][1]):
        maryoku += abs((zahyou[atai+D-1])[0]-(zahyou[atai-1])[0]) + abs((zahyou[atai+D-1])[1]-(zahyou[atai-1])[1])
        atai += D
        maryoku, = maryoku
    print(maryoku)
    maryoku = 0

### FIXED CODE ###

import numpy as np
H, W, D = list(map(int, input().split()))

px, py = [None for i in range(H*W+1)], [None for i in range(H*W+1)]
for i in range(H):
    A = list(map(int, input().split()))
    for j in range(W):
        px[A[j]] = i
        py[A[j]] = j

d = [0 for i in range(H*W+1)]
for i in range(D+1, H*W+1):
    d[i]= d[i-D]+abs(px[i]-px[i-D])+abs(py[i]-py[i-D])

Q = int(input())

for i in range(Q):
    L, R = list(map(int, input().split()))
    print(d[R]-d[L])
### BUGGY CODE ###

import math
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass
N,M = map(int,input().split())
L = prime_factor(M)
L.append(0)
K = []
cur = L[0]
cnt = 0
for i in range(len(L)):
  if cur == L[i]:
    cnt += 1
  else:
    K.append(cnt)
    cnt = 1
    cur = L[i]
ans = 1
for i in range(len(K)):
  n = K[i]+N-1
  k = N-1
  a = (math.factorial(n))%(10**9+7)
  b = (math.factorial(k)%(10**9+7))
  c = (math.factorial(n-k)%(10**9+7))
  ans *= (a*pow(b*c,10**9+5,10**9+7))%(10**9+7)
print(ans%(10**9+7))

### FIXED CODE ###

import math
def prime_factor(n):
    ass = []
    for i in range(2,int(n**0.5)+1):
        while n % i==0:
            ass.append(i)
            n = n//i
    if n != 1:
        ass.append(n)
    return ass
N,M = map(int,input().split())
L = prime_factor(M)
L.append(0)
K = []
cur = L[0]
cnt = 0
for i in range(len(L)):
  if cur == L[i]:
    cnt += 1
  else:
    K.append(cnt)
    cnt = 1
    cur = L[i]
ans = 1
for i in range(len(K)):
  n = K[i]+N-1
  k = N-1
  cur = 1
  for i in range(k+1,n+1):
    cur *= i
  for j in range(1,n-k+1):
    cur = cur//j
  ans *= cur%(10**9+7)
print(ans%(10**9+7))
### BUGGY CODE ###

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

a_sorted = sorted(a)
#print(a)
#print(a_sorted)

a_idx = [str(1+a.index(x)) for x in a_sorted]
#print(a_idx)

print(' '.join(a_idx))


### FIXED CODE ###

import numpy as np

n = int(input())
a = [int(x) for x in input().split()]
np_a = np.array(a)

a_idx = np.argsort(np_a)
#print(a_idx)

res = [str(1+int(x)) for x in a_idx.tolist()]
#print(res)

print(' '.join(res))
### BUGGY CODE ###

#!/usr/bin/env python3

from bisect import insort_right
from collections import deque

n, m, *a = map(int, open(0).read().split())

a = deque(sorted(a))
for _ in range(m):
    insort_right(a, a.pop() >> 1)
print(sum(a))


### FIXED CODE ###

#!/usr/bin/env python3

from bisect import insort_right

n, m, *a = map(int, open(0).read().split())
a.sort()
for _ in range(m):
    insort_right(a, a.pop() >> 1)
print(sum(a))
### BUGGY CODE ###

c=int(input())
l=[int(input()) for _ in range(c)]
for i in range(len(l)):

    for j in range(len(l)):
        if i <j and l[i] < l[j]:
            c=c-1
print(abs(c))

### FIXED CODE ###

import bisect
 
n = int(input())
a = [int(input()) for _ in range(n)]
# それぞれの色の最大値を入れる筒のリスト
t = [a[-1]]
 
for i in reversed(a[:-1]):
    # それぞれの色のどの値よりも小さかったとき
    idx = bisect.bisect_left(t, i+1)
    # print(i, idx)
    if idx == len(t):
        t.append(i)
    # 効率的な色の探索
    else:
        t[idx] = i
    # print(t)
 
print(len(t))