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

import numpy as np
from collections import defaultdict
from functools import reduce

import bisect

# s = input()
Q = int(input())
# A = list(map(int, input().split()))
# n, m, k = map(int, input().split())


As = []
A_left = 0
A_right = 0

b_sum = 0

# n = len(As)
# n is odd:
# A_left + As[n//2] + B_left
# n is even:
# A_left + B_left

for i in range(Q):
    query = list(map(int, input().split()))

    if query[0] == 1:
      a =  query[1]
      n = len(As)
      if n == 0:
        As.append(a)
      else:
        idx = bisect.bisect_left(As, a)
        if n%2 == 0: # even
          if idx < n//2:
            A_left += a
            A_left -= As[n//2-1]
          elif idx > n//2:
            A_right += a
            A_right -= As[n//2]
        else: # odd
          if idx <= n//2:
            A_left += a
            A_right += As[n//2]
          else:
            A_right += a
            A_left += As[n//2]
        bisect.insort_left(As, a)

      # print(As)
      # print(A_left)
      # print(A_right)

      b_sum += query[2]
    else:
      n = len(As)
      if n%2 == 0: #even
        print(As[n//2-1], A_right - A_left + b_sum)
      else:
        print(As[n//2], A_right - A_left + b_sum)


### FIXED CODE ###

# import numpy as np
# from collections import defaultdict
# from functools import reduce

import heapq

# s = input()
Q = int(input())
# A = list(map(int, input().split()))
# n, m, k = map(int, input().split())


A_left_sum = 0
A_left = []
A_right_sum = 0
A_right = []
A_med = None
query_size = 0
b_sum = 0

# n = len(As)
# n is odd:
# A_left + As[n//2] + B_left
# n is even:
# A_left + B_left

for i in range(Q):
    query = list(map(int, input().split()))

    if query[0] == 1:
      a =  query[1]
      if A_med is None:
        A_med = a
      else:
        if query_size%2 == 0: # even
          left_max = -A_left[0]
          right_min = A_right[0]
          if a < left_max:
            heapq.heappushpop(A_left, -a)
            A_left_sum += a - left_max
            A_med = left_max
          elif a > right_min:
            heapq.heappushpop(A_right, a)
            A_right_sum += a - right_min
            A_med = right_min
          else:
            A_med = a
        else: # odd
          if A_med <= a:
            heapq.heappush(A_left, -A_med)
            heapq.heappush(A_right, a)
            A_left_sum += A_med
            A_right_sum += a
          else:
            heapq.heappush(A_left, -a)
            heapq.heappush(A_right, A_med)
            A_right_sum += A_med
            A_left_sum += a

      # print(As)
      # print(A_left)
      # print(A_right)
      query_size += 1

      b_sum += query[2]
    else:
      if query_size%2 == 0: #even
        print(-A_left[0], A_right_sum - A_left_sum + b_sum)
      else:
        print(A_med, A_right_sum - A_left_sum + b_sum)
### BUGGY CODE ###

N,K = map(int,input().split())
H = list(map(int,input().split()))
H.insert(0,0)
dp = [0 for _ in range(N+1)]
dp[N-1] = abs(H[N]-H[N-1])
for i in range(N-2,0,-1):
    dp[i] = abs(H[i+1]-H[i])+dp[i+1]
    for k in range(2,K+1):
        if i+k<=N:
            dp[i] = min(dp[i],abs(H[i+k]-H[i])+dp[i+k])
print(dp[1])

### FIXED CODE ###

N,K = map(int,input().split())
H = list(map(int,input().split()))
H.insert(0,0)
dp = [0 for _ in range(N+1)]
dp[N-1] = abs(H[N]-H[N-1])
for i in range(N-2,0,-1):
    dp[i] = abs(H[i+1]-H[i])+dp[i+1]
    for k in range(2,K+1):
        if i+k<=N:
            dp[i] = min(dp[i],abs(H[i+k]-H[i])+dp[i+k])
print(dp[1])
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
a = [0] + a + [0]
d = []
for i in range(n+1):
    d.append(abs(a[i+1]-a[i]))
for i in range(1, n+1):
    if max(a[i-1:i+2]) == a[i] or min(a[i-1:i+2]) == a[i]:
        tmp = d[:i-1] + [abs(d[i-1]-d[i])] + d[i+1:]
        print(sum(tmp))
    else:
        print(sum(d))
            

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
a = [0] + a + [0]
d = []
for i in range(n+1):
    d.append(abs(a[i+1]-a[i]))
s = sum(d)
for i in range(1, n+1):
    if max(a[i-1:i+2]) == a[i] or min(a[i-1:i+2]) == a[i]:
        tmp = abs(d[i]-d[i-1])
        print(s - d[i-1] - d[i] + tmp)
    else:
        print(s)
### BUGGY CODE ###

n=int(input())
l=list(map(int,input().split()))
f=l[0]
from fractions import gcd

for i in l:
    f=f*i//gcd(f,i)
mod=10**9+7
ans=0
for i in l:
  ans+=f//i%mod
  ans%=mod
print(ans)


### FIXED CODE ###

def s():
  from sys import stdin
  read=stdin.buffer.readline
  n=int(read())
  l=list(map(int,read().split()))
  f=l[0]
  mod=10**9+7
  def gcd(s,d):
    s,d=max(s,d),min(s,d)
    while  d:
      s,d=d,s%d
    return s
  for i in l:
    f=i*f//gcd(i,f)
  ans=0
  for iu in l:
    b,u,v=mod,1,0
    while b:
      t=iu//b;iu,b=b,iu%b;u-=t*v;u,v=v,u
    ans+=(f*u%mod)%mod
    ans%=mod
  print(ans)
  
if __name__=="__main__":s()
### BUGGY CODE ###

h,w,n=map(int,input().split())
s=set()
l=[[0,0],[1,1],[1,-1],[-1,1],[-1,-1],[0,1],[0,-1],[1,0],[-1,0]]
ans=[(h-2)*(w-2),0,0,0,0,0,0,0,0,0]
for i in range(n):
    a,b=[int(j) for j in input().split()]
    s.add((a,b))
    for i,j in l:
        if a+i>=1 and a+i<=h and b+j>=1 and b+j<=w:
            c=0
            for p,q in l:
                if a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w:
                    if (a+i+p,b+j+q) in s:
                        c+=1
                else:
                    c=0
                    break
            if c!=0:
                ans[c-1]-=1
                ans[c]+=1

for i in range(10):
    print(ans[i])







### FIXED CODE ###

h,w,n=map(int,input().split())
s=set()
l=[[0,0],[1,1],[1,-1],[-1,1],[-1,-1],[0,1],[0,-1],[1,0],[-1,0]]
ans=[(h-2)*(w-2),0,0,0,0,0,0,0,0,0]
for i in range(n):
    a,b=[int(j) for j in input().split()]
    s.add((a,b))
    for i,j in l:
        if a+i>=1 and a+i<=h and b+j>=1 and b+j<=w:
            c=0
            for p,q in l:
                if a+i+p>=1 and a+i+p<=h and b+j+q>=1 and b+j+q<=w:
                    if (a+i+p,b+j+q) in s:
                        c+=1
                else:
                    c=0
                    break
            if c!=0:
                ans[c-1]-=1
                ans[c]+=1

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

n=int(input())
lst=[int(input()) for i in range(n)]
for j in range(n):
  if j==0:
    print(max(lst[1:]))
  elif j==n-1:
    print(max(lst[:n]))
  else:
    a=max(lst[:j])
    b=max(lst[j+1:])
    print(max(a,b))

### FIXED CODE ###

n=int(input())
lst=[int(input()) for i in range(n)]
a=max(lst)
aind=lst.index(a)
if aind==0:
  b=max(lst[1:])
elif aind==n-1:
  b=max(lst[:n-2])
else:
  tempa=max(lst[:aind])
  tempb=max(lst[aind+1:])
  b=max(tempa, tempb)
bind=lst.index(b)
for j in range(n):
  if j==aind:
    print(b)
  else:
    print(a)
### BUGGY CODE ###

N, M = map(int, input().split())
broken = []
for i in range(M):
  broken.append(int(input()))
a1, a2, a3 = 1, 0, 0
for i in range(1, N+1):
  a3 = a2
  a2 = a1
  if i in broken:
    a1 = 0
  else:
    a1 = (a2 + a3) % 1000000007
print(a1)

### FIXED CODE ###

N, M = map(int, input().split())
m = 0
if M > 0:
  broken = int(input())
else:
  broken = 0
a1, a2, a3 = 1, 0, 0
for i in range(1, N+1):
  a3, a2 = a2, a1
  if i == broken:
    a1 = 0
    m += 1
    if m < M:
      broken = int(input())
  else:
    a1 = (a2 + a3) % 1000000007
print(a1)
### BUGGY CODE ###

import copy
import itertools

h, w, k = map(int, input().split())
#s= list(input())

s = []
min = 100000
for i in range(h):
    s.append( [int(s) for s in list(input())])

l = list(range(h-1))
for i in range(h):
    p = list(itertools.combinations(l, i))
    for j in p:
        tmp = list(j)
        tmps = []
        q = 0
        tmps.append([])
        for r in range(h):
            tmps[q].append(copy.copy(s[r]))
            if(q < len(tmp) and r==tmp[q]):
                tmps.append([])
                q += 1
        #print(tmps)
        count = i
        sums = [0] * len(tmps)
        precut = 1
        exitflg = 0
        for r in range(w):
            for q in range(len(tmps)):
                for t in tmps[q]:
                    sums[q] += t[r]
            cutflg = 0
            for q in range(len(tmps)):
                if sums[q] > k :
                    cutflg = 1
            if cutflg == 1:
                #print('cut')
                count += 1
                sums = [0] * len(tmps)
                for q in range(len(tmps)):
                    for t in tmps[q]:
                        sums[q] += t[r]
            for q in range(len(tmps)):
                if sums[q] > k :
                    exitflg = 1
                    #print('exit')
        #print(exitflg)
        if exitflg == 0:
            if min > count:
                min = count
print(min)

### FIXED CODE ###

import copy
import itertools

h, w, k = map(int, input().split())
#s= list(input())

s = []
min = 100000
for i in range(h):
    s.append( [int(s) for s in list(input())])
    #s.append([1]*w)

dbg_cnt = 0
l = list(range(h-1))
for i in range(h):
    p = list(itertools.combinations(l, i))
    for j in p:
        tmp = list(j)
        tmps = []
        q = 0
        tmps.append([])
        #print(dbg_cnt)
        #dbg_cnt += 1
        for r in range(h):
            tmps[q].append(copy.copy(s[r]))
            if(q < len(tmp) and r==tmp[q]):
                tmps.append([])
                q += 1
        #print(tmps)
        count = i
        sums = [0] * len(tmps)
        precut = 1
        exitflg = 0
        for r in range(w): #550000
            for q in range(len(tmps)):
                for t in tmps[q]:
                    sums[q] += t[r] #5500000
            cutflg = 0
            for q in range(len(tmps)):
                if sums[q] > k : #5500000
                    cutflg = 1
            if cutflg == 1:
                #print('cut')
                count += 1
                sums = [0] * len(tmps)
                for q in range(len(tmps)):
                    for t in tmps[q]:
                        sums[q] += t[r] #5500000
            for q in range(len(tmps)): #5500000
                if sums[q] > k :
                    exitflg = 1
                    #print('exit')
        #print(exitflg)
        if exitflg == 0:
            if min > count:
                min = count
print(min)
### BUGGY CODE ###

import sys
for n in sys.stdin:
    n=int(n)
    prime = [2]
    for i in xrange(3,n):
        flag=0
        for j in prime:
            if (i%j == 0):
                flag=1
                break
        if flag==0:
            prime.append(i)
    print len(prime)

### FIXED CODE ###

import sys
n=999999
prime = [1]*(n+1)
(prime[0],prime[1])=(0,0)
for i in [v for v in xrange(2,n+1) if v*v<n+1]:
        for j in xrange(i*i,n+1,i):
            prime[j]=0

for inp in sys.stdin:
    print prime[:int(inp)+1].count(1)
### BUGGY CODE ###

N = int(input())
lst = [int(input()) for _ in range(N)]


for j in range(len(lst)):
    if max(lst) != lst[j]:
        print(max(lst))
    else:
        print(sorted(lst)[-2])



### FIXED CODE ###

N = int(input())
lst = [int(input()) for _ in range(N)]

mx = max(lst)
clst = sorted(lst)
mx2 = clst[-2]

for j in range(N):
    if mx != lst[j]:
        print(mx)
    else:
        print(mx2)
### BUGGY CODE ###

import sys

def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N,K = MI()
A = LI()
A.sort()


def f(n):  # Anが必要か否か
    B = [0] + [A[i] for i in range(N) if i != n]
    dp = [[0]*K for _ in range(2)]  # dp[i][j] = B1~Biを用いてjを作れるか(メモリ節約のため工夫してる)
    dp[0][0] = 1
    for i in range(1,N):
        b = B[i]
        if i % 2 == 1:
            for j in range(K):
                dp[1][j] = dp[0][j]
                if dp[1][j] == 0 and j >= b:
                    dp[1][j] = dp[0][j-b]
        else:
            for j in range(K):
                dp[0][j] = dp[1][j]
                if dp[0][j] == 0 and j >= b:
                    dp[0][j] = dp[1][j-b]
    if sum(dp[(N-1) % 2 == 1][j] for j in range(max(K-A[n],0),K)) != 0:
        return True
    else:
        return False


left = -1  # 不必要
right = N  # 必要
while left + 1 < right:
    mid = (left + right)//2
    if f(mid):
        right = mid
    else:
        left = mid

print(right)


### FIXED CODE ###

import sys

def MI(): return map(int,sys.stdin.readline().rstrip().split())
def LI(): return list(map(int,sys.stdin.readline().rstrip().split()))  #空白あり


N,K = MI()
A = LI()
A.sort()


def f(n):  # Anが必要か否か
    B = [0] + [A[i] for i in range(N) if i != n]
    dp = [[0]*K for _ in range(2)]  # dp[i][j] = B1~Biを用いてjを作れるか(メモリ節約のため工夫してる)
    dp[0][0] = 1
    for i in range(1,N):
        b = B[i]
        for j in range(K):
            if j >= b:
                dp[i%2][j] = dp[1-i%2][j] | dp[1-i%2][j-b]
            else:
                dp[i%2][j] = dp[1-i%2][j]
    if sum(dp[(N-1) % 2][j] for j in range(max(K-A[n],0),K)) != 0:
        return True
    else:
        return False


left = -1  # 不必要
right = N  # 必要
while left + 1 < right:
    mid = (left + right)//2
    if f(mid):
        right = mid
    else:
        left = mid

print(right)
### BUGGY CODE ###

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


total = 3 * 10 ** 5

for i in range(n):
    total = min(total,(s[:i].count("W")+s[i:].count("E")))

print(total)

### FIXED CODE ###

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

total = s.count("E")

min_val = total

for char in s:
    if char == "E":
        total -= 1
    else:
        total += 1
    min_val = min(min_val, total)

print(min_val)
### BUGGY CODE ###

s=[j for j in input()]
#print(len(s))
#print(s)

def check():
  flag=0
  for j in range(len(s)-1):
    if s[j]=='B' and s[j+1]=='W':
      flag=1
  return flag

ans=0
while check()==1:
  for j in range(len(s)-1):
    if s[j]=='B' and s[j+1]=='W':
      ans+=1
      s[j]='W'
      s[j+1]='B' 
  check()

print(ans)

### FIXED CODE ###

s=[i for i in input()]
#print(s)

cntb=0
cnta=0
for k in range(len(s)):
  if s[k]=='B':
    cntb+=1
  if s[k]=='W':
    cnta+=cntb

print(cnta)
### BUGGY CODE ###

N=int(input())
D,M,C=map(ord,'DMC')
S=[ord(c) for c in input()]
input()
K=map(int,input().split())
for k in K:
    d,m,c,dm=0,0,0,0
    a=0
    for i,s in enumerate(S):
        if i>=k:
            if S[i-k]==D:
                d-=1
                dm-=m
            elif S[i-k]==M:
                m-=1
            elif S[i-k]==C:
                c-=1
        if s==D:
            d+=1
        elif s==M:
            m+=1
            dm+=d
        elif s==C:
            c+=1
            a+=dm
    print(a)

### FIXED CODE ###

N=int(input())
D,M,C=map(ord,'DMC')
import numpy as np
S=np.array([ord(c) for c in input()])
input()
K=map(int,input().split())
iD=S==D
iM=S==M
iC=S==C
cD=np.cumsum(iD,dtype=np.int64)
cM=np.cumsum(iM,dtype=np.int64)
for k in K:
    cD2=cD-np.concatenate((np.zeros(k,dtype=np.int64),cD[:-k]))
    cM2=cM-np.concatenate((np.zeros(k,dtype=np.int64),cM[:-k]))
    DM=np.cumsum(cD2*iM-np.concatenate((np.zeros(k,dtype=np.int64),cM2[k-1:-1]*iD[:-k])))
    print(np.sum(iC*DM))
### BUGGY CODE ###

N = int(input())
A = [int(input()) for i in range(N)]
result = [max(A[:i] + A[i+1:]) for i in range(N)]
for i in range(N):
    print(result[i])

### FIXED CODE ###

N = int(input())
A = [int(input()) for i in range(N)]

max_num = max(A)
a = sorted(A)
second = a[-2]

for i in range(N):
    if A[i] == max_num:
        print(second)
    else:
        print(max_num)
### BUGGY CODE ###

from sys import stdin,stdout
LI=lambda:list(map(int,input().split()))
MAP=lambda:map(int,input().split())
IN=lambda:int(input())
S=lambda:input()
import math
from collections import Counter,defaultdict


n=IN()
ans=""
while n>0:
    b=n%26
    if b==0:
        ans='z'+ans
    else:
        ans=chr(ord('a')+b-1)+ans
        n//=26
print(ans)
        



### FIXED CODE ###

n=int(input())
ans = " "
while n>0:
    re=n%26
    if re!=0:
        ans= chr(ord('a')+re-1)+ans
        n=n//26
    else:
        ans='z'+ans
        n=(n//26)-1
print(ans)
### BUGGY CODE ###

S = list(input().rstrip())
Q = int(input().rstrip())


q = []
for n in range(Q):
  q.append(list(input().rstrip().split()))

#print(q)
def rev(olist):
  nlist  = olist[::-1]
  return nlist

def addhead(olist,ele):
  nlist = olist.insert(0,ele)
  return nlist
  
def addtail(olist,ele):
  nlist = olist.append(ele)
  return nlist

def rev2(flg):
  if flg == 0:
    flg = 1
  else:
    flg = 0
  return flg

def add(olist,ele,j,flg,head,tail):
  if j == '1' and flg == 0:
    head.insert(0,ele)
  elif j == '1' and flg == 1:
    tail.append(ele)
  elif j == '2' and flg == 0:
    tail.append(ele)
  elif j == '2' and flg == 1:
    head.insert(0,ele)

flg = 0
head = []
tail = []

for n in range(Q):
  
  if q[n][0] == '1':
    flg = rev2(flg)
  
  else:
    add(S,q[n][2],q[n][1],flg,head,tail)

ans = head + S + tail

if flg == 1:
  ans = rev(ans)
  
print(''.join(ans))



### FIXED CODE ###

S = input().rstrip()
Q = int(input().rstrip())


q = []
for n in range(Q):
  q.append(list(input().rstrip().split()))

#print(q)
def rev(olist):
  nlist  = olist[::-1]
  return nlist

def addhead(olist,ele):
  nlist = olist.insert(0,ele)
  return nlist
  
def addtail(olist,ele):
  nlist = olist.append(ele)
  return nlist

def rev2(flg):
  if flg == 0:
    flg = 1
  else:
    flg = 0
  return flg

def add(olist,ele,j,flg,head,tail):
  if j == '1' and flg == 0:
    head.insert(0,ele)
  elif j == '1' and flg == 1:
    tail.append(ele)
  elif j == '2' and flg == 0:
    tail.append(ele)
  elif j == '2' and flg == 1:
    head.insert(0,ele)
  
def add2(olist,ele,j,flg,head,tail):
  if j == '1' and flg == 0:
    head = ele + head
  elif j == '1' and flg == 1:
    tail = tail + ele
  elif j == '2' and flg == 0:
    tail = tail + ele
  elif j == '2' and flg == 1:
    head = ele + head
  return head,tail
flg = 0
#head = []
#tail = []
head=''
tail = ''
for n in range(Q):
  
  if q[n][0] == '1':
    flg = rev2(flg)
  
  else:
    head,tail = add2(S,q[n][2],q[n][1],flg,head,tail)


ans = head + S + tail

if flg == 1:
  ans1 = rev(list(ans))
  print(''.join(ans1))
else:
  print(ans)
### BUGGY CODE ###

a,b,n=map(int,input().split())
ans=0
x=0
y=0
# while(x<=n or y<=n):
#     ans=max(ans,((a*x)//b - a*(x//b)),((a*y)//b - a*(y//b)))
#     x+=b
#     y=-(-x//a)

for i in range(n+1):
    ans=max(ans,((a*i)//b - a*(i//b)))
print(ans)


### FIXED CODE ###

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

def f(x):
    return (a*x)//b - a*(x//b)

print(f(min(b-1,n)))
### BUGGY CODE ###

s = str(input())

partlen = 3

flag = True

res = -1

while flag:
    for i in range(len(s)-partlen+1):
        BoderNum = partlen // 2 +1
        temp = s[i:i+partlen]
        for j in range(partlen):
            TestNum = temp.count(temp[j])
            if TestNum >= BoderNum:
                print(i+1,i+partlen)
                flag = False
                break
        if flag == False:
            break
    if partlen == len(s):
        print(res,res)
        break
    partlen += 1


### FIXED CODE ###

s = str(input())

flag = True

res = -1

import sys

if len(s) == 2:
    if s[0] == s[1]:
        print(1,2)
    else:
        print(-1,-1)
    sys.exit()

for i in range(len(s)-2):
    if s[i] == s[i+1]:
        print(i+1,i+3)
        flag = False
        break
    elif s[i] == s[i+2]:
        print(i+1,i+3)
        flag = False
        break

if flag:
    if s[-2] == s[-1]:
        print(len(s)-2,len(s))
    elif s[-3] == s[-1]:
        print(len(s)-2,len(s))
    else:
        print(res,res)
### BUGGY CODE ###

n=int(input())
v=list(map(int,input().split()))
odd=v[1::2]
even=v[0::2]
a=[]
b=[]
lodd=list(set(odd))
leven=list(set(even))
for i in range(len(lodd)):
    a.append([odd.count(lodd[i]),lodd[i]])
for i in range(len(leven)):
    b.append([even.count(leven[i]),leven[i]])
a.sort()
b.sort()
if a[-1][1]!=b[-1][1]:
    print(n-a[-1][0]-b[-1][0])
elif a[-1][1]==b[-1][1]:
    if len(a)>1 and len(b)>1:
        print(min(n-a[-1][0]-b[-2][0],n-a[-2][0]-b[-1][0]))
    elif len(a)>1 and len(b)==1:
        print(n-a[-2][0]-b[0][0])
    elif len(a)==1 and len(b)>1:
        print(n-a[0][0]-b[-2][0])
    elif len(a)==1 and len(b)==1:
        print(n//2)

### FIXED CODE ###

from collections import Counter
n=int(input())
v=list(map(int,input().split()))
odd=v[1::2]
even=v[0::2]
a=Counter(odd)
b=Counter(even)
if a.most_common()[0][0]!=b.most_common()[0][0]:
    print(n-a.most_common()[0][1]-b.most_common()[0][1])
else:
    if len(a)>1 and len(b)>1:
        print(min(n-a.most_common()[0][1]-b.most_common()[1][1],n-a.most_common()[1][1]-b.most_common()[0][1]))
    elif len(a)>1 and len(b)==1:
        print(n-a.most_common()[1][1]-b.most_common()[0][1])
    elif len(a)==1 and len(b)>1:
        print(n-a.most_common()[0][1]-b.most_common()[1][1])
    elif len(a)==1 and len(b)==1:
        print(n//2)
### BUGGY CODE ###

#C
n = int(input())
a = list(map(int, input().split()))
ans = [0] * n
for people in range(n):
    for j in range(n):
        if a[j] == people+1:
            ans[people] = j + 1
print(*ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
b=[0]*n
for i in range(n):
    b[a[i]-1]=i+1
print(*b)
### BUGGY CODE ###

n=int(input())
s=list(input())
count=0

for i in range(1000):
    if len(str(i))==1:
        i=str(0)+str(0)+str(i)
    elif len(str(i))==2:
        i=str(0)+str(i)
    else:
        i=str(i)
    x=0
    for j in range(n):
        if s[j]==i[x]:
            x+=1
            if x==3:
                count+=1
                break
print(count)
            



### FIXED CODE ###

n=int(input())
s=list(input())
count=0

for i in range(1000):
    if len(str(i))==1:
        i=str(0)+str(0)+str(i)
    elif len(str(i))==2:
        i=str(0)+str(i)
    else:
        i=str(i)
    x=0
    for j in range(n):
        if s[j]==i[x]:
            x+=1
            if x==3:
                count+=1
                break
print(count)