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

n = int(input())
import numpy as np
arr = np.array(list(set(map(int, input().split()))))

from collections import deque
q = deque([arr])
ans = arr.min()
while len(q) > 0:
    ar = q.popleft()
    ans = min(ar.min(), ans)
    if ans == 1:
        break
    for mon in ar:
        tmp = (ar - 1) % mon + 1
        if np.any(ar != tmp):
            q.append(tmp)

print(ans)


### FIXED CODE ###

n = int(input())
from functools import reduce
from fractions import gcd
ans = reduce(gcd, (map(int, input().split())))

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

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

coun = [0] * n;

for i in range(n):
  num = A.count(i+1);
  coun[i] = num;

for j in coun:
  print(j);

### FIXED CODE ###

import collections

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

ans = [0] * n;

c = collections.Counter(A)
key = list(c.keys());
value = list(c.values());

for i in range(len(key)):
    ans[key[i]-1] = value[i];
  
for a in ans:
  print(a);
### BUGGY CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
A.sort()
ope = []
for _ in range(M):
  ope.append(list(map(int, input().split())))
for m in ope:
  for i in range(m[0]):
    if m[1] > A[i]:
      A[i] = m[1]
  A.sort()
print(sum(A))  

### FIXED CODE ###

N, M = map(int, input().split())
A = list(map(int, input().split()))
ans = 0
pool = []
[pool.append((a, 1)) for a in A]
for _ in range(M):
  b, c = (map(int, input().split()))
  pool.append((c, b))
pool.sort(reverse=True, key=lambda x:x[0])

while N>0:
  for p in pool:
    if p[1] >= N:
      ans += p[0]*N
      N = 0
    if p[1] < N:
      ans += p[0]*p[1]
      N -= p[1]

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

a,b,c,d = map(int,input().split())
cnt = 0
for i in range(a,b+1):
    if i%c!=0 and i%d!=0:
        cnt += 1
print(cnt)

### 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)

A, B, C, D = map(int, input().split())

b_num = B//C + B//D - B//lcm(C, D)
a_num = (A-1)//C + (A-1)//D - (A-1)//lcm(C, D)

print((B-A+1) -(b_num - a_num))
### BUGGY CODE ###

n,m=map(int,input().split())
visited = [[False,False,False] for _ in range(n)]
ren = [[0]*n for _ in range(n)]
for i in range(m):
    u,v = map(int,input().split())
    ren[u-1][v-1] = 1
s,t = map(int,input().split())

Q = [(s,0)]
visited[s-1][2]=True
ans = -1

while len(Q)>0:
    curs,curcount = Q.pop(0)
    if curs == t:
        ans = curcount
        break
    for i in range(n):
        if ren[curs-1][i] and not visited[i][0]:
            visited[i][0]=True
            for j in range(n):
                if ren[i][j] and not visited[j][1]:
                    visited[j][1]=True
                    for k in range(n):
                        if ren[j][k] and not visited[k][2]:
                            visited[k][2]=True
                            Q.append((k+1,curcount+1))

print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
visited = [[False,False,False] for _ in range(n)]
ren = [[] for _ in range(n)]
for i in range(m):
    u,v = map(int,input().split())
    ren[u-1].append(v)
s,t = map(int,input().split())

Q = [(s,0)]
visited[s-1][2]=True
ans = -1

while len(Q)>0:
    curs,curcount = Q.pop(0)
    if curs == t:
        ans = curcount
        break
    for i in ren[curs-1]:
        if not visited[i-1][0]:
            visited[i-1][0]=True
            for j in ren[i-1]:
                if not visited[j-1][1]:
                    visited[j-1][1]=True
                    for k in ren[j-1]:
                        if not visited[k-1][2]:
                            visited[k-1][2]=True
                            Q.append((k,curcount+1))

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

n=int(input())
a=[int(i) for i in input().split()]
a.sort()
i=1
while True:
    if len(a)==1:
        break
    else:
        if i>=len(a):
            i=1
        if a[i] % a[0]==0:
            del a[i]
        else:
            a[i]-=a[0]
            if a[i]==0:
                del a[i]
    a.sort()
    i+=1
print(a[0])

### FIXED CODE ###


n=int(input())
a=[int(i) for i in input().split()]
c=a[0]
def gcd(x,y):
    while y:
        x,y=y,x%y
    return x

for i in a:
    c=gcd(c,i)
print(c)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
from math import factorial
from functools import lru_cache

def fact(x: int):
    if(x == 0 or x == 1):
        return 1
    if(dp[x] != 0):
        return dp[x]
    else:
        dp[x] = x * fact(x-1)
        
    return dp[x]

# @lru_cache(maxsize=1000000000)
def comb(n: int, r: int):
    # return fact(n) // (fact(r)*fact(n-r))
    return factorial(n) // (factorial(r)*factorial(n-r))


# dp = [0] * 1000000000

def solve(n: int, a: "List[int]"):
    a.sort()

    ai,aj = 0,0
    ans = 0
    for i in range(n-1, -1, -1):
        t = a[i] / 2
        from bisect import bisect_left, bisect_right
        nx = bisect_left(a, t)-1
        j = nx
        if(0 <= nx+1 <= n-1 and abs(a[nx]-t) > abs(a[nx+1]-t)):
            j = nx+1
        c = comb(a[i], a[j])
        if(c > ans):
            ai, aj = a[i], a[j]
            ans = c
            
    print(ai,aj)
    
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(n)]  # type: "List[int]"
    solve(n, a)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from math import factorial
from functools import lru_cache

def fact(x: int):
    if(x == 0 or x == 1):
        return 1
    if(dp[x] != 0):
        return dp[x]
    else:
        dp[x] = x * fact(x-1)
        
    return dp[x]

# @lru_cache(maxsize=1000000000)
def comb(n: int, r: int):
    # return fact(n) // (fact(r)*fact(n-r))
    return factorial(n) // (factorial(r)*factorial(n-r))


# dp = [0] * 1000000000

def solve(n: int, a: "List[int]"):
    a.sort()

    m = a[-1]
    print(m, min(a, key=lambda x:abs(m-x*2)))
    
    return


# Generated by 1.1.5 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    n = int(next(tokens))  # type: int
    a = [int(next(tokens)) for _ in range(n)]  # type: "List[int]"
    solve(n, a)

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

#標準入力
X = int(input())

max_beki = 1
for i in range(1,X):
  for j in range(2,X):
    beki = i ** j
    
    if beki > max_beki:
      if beki <= X:
        max_beki = beki
      
print(max_beki)


### FIXED CODE ###

#標準入力
X = int(input())

max_beki = 1
for i in range(1,X):
  for j in range(2,X):
    beki = i ** j
    
    if beki > X:
      break
      
    elif beki > max_beki:
      max_beki = beki
 
print(max_beki)
### BUGGY CODE ###

from collections import Counter
import sys

n, m, k = map(int, input().split())
F = [[] for _ in range(n+1)]
B = [[] for _ in range(n+1)]

sys.setrecursionlimit(10**9)
for _ in range(m):
    a, b = map(int, input().split())
    F[a].append(b)
    F[b].append(a)

rks = [0]*(n+1)

def dfs(s,r):
    if rks[s] == 0:
        rks[s] = r
    else:
        return
    for i in F[s]:
        dfs(i,r)

r = 0
for i in range(1,n+1):
    if rks[i] == 0:
        r += 1
        dfs(i,r)

for _ in range(k):
    c, d = map(int, input().split())
    if rks[c] == rks[d]:
        B[c].append(d)
        B[d].append(c)

counter = Counter(rks)
for i in range(1,n+1):
    print(counter[rks[i]] - len(F[i]) - len(B[i]) - 1)




### FIXED CODE ###

import sys
from math import *
from collections import deque, Counter, defaultdict
from fractions import gcd
input = lambda: sys.stdin.readline().rstrip()

def eprint(s):
    sys.stderr.write('DEBUG: {}'.format(s))
    return

def main():
    n, m, k = map(int, input().split())
    fgraph = [list() for i in range(n)]
    bgraph = [list() for i in range(n)]
    cgraph = [list() for i in range(n)]
    
    rks = [None] *n
    sys.setrecursionlimit(10**9)
    # r: どの連結成分に存在するかをメモするid
    def dfs(graph,s,r):
        if rks[s] is None:
            rks[s] = r
        for i in range(len(graph[s])):
            if rks[graph[s][i]-1] is not None:
                continue
            dfs(graph, graph[s][i]-1,r)

    for i in range(m):
        a,b = map(int, input().split())
        fgraph[a-1].append(b)
        fgraph[b-1].append(a)

    # print(fgraph)
    #print(bgraph)
    # 連結成分に対してid的なindexをつける
    c = -1
    for i in range(n):
        if rks[i] is None:
            c += 1
            dfs(fgraph, i, c)
    
    for i in range(k):
        c,d = map(int, input().split())
        if rks[c-1] == rks[d-1]:
            bgraph[d-1].append(c)
            bgraph[c-1].append(d)

    counter = Counter(rks)
    for i in range(n):
        # counter[rks[i]] 連結成分のサイズ
        # len(fgraph[i]) 友達の数
        # len(bgraph[i]) 連結成分内のブロックの数
        # 1 自分
        print(counter[rks[i]] - len(fgraph[i]) - len(bgraph[i]) - 1)

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

# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import math
from functools import lru_cache

#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

#############
# Main Code #
#############

N = int(input())

def count(n,a,b):
  counter = 0
  for i in range(1,n+1):
    if int(str(i)[0])==a and int(str(i)[-1])==b:
      counter += 1
  return counter

ans = 0
for i in range(10):
  for j in range(10):
    ans += count(N,i,j)*count(N,j,i)

print(ans)

### FIXED CODE ###

# -*- coding: utf-8 -*-

#############
# Libraries #
#############

import math
from functools import lru_cache

#############
# Constants #
#############

MOD = 10**9 +7
INF = float('inf')

#############
# Functions #
#############

kaijo_memo = []
def kaijo(n):
  if(len(kaijo_memo) > n):
    return kaijo_memo[n]
  if(len(kaijo_memo) == 0):
    kaijo_memo.append(1)
  while(len(kaijo_memo) <= n):
    kaijo_memo.append(kaijo_memo[-1] * len(kaijo_memo) % MOD)
  return kaijo_memo[n]

gyaku_kaijo_memo = []
def gyaku_kaijo(n):
  if(len(gyaku_kaijo_memo) > n):
    return gyaku_kaijo_memo[n]
  if(len(gyaku_kaijo_memo) == 0):
    gyaku_kaijo_memo.append(1)
  while(len(gyaku_kaijo_memo) <= n):
    gyaku_kaijo_memo.append(gyaku_kaijo_memo[-1] * pow(len(gyaku_kaijo_memo),MOD-2,MOD) % MOD)
  return gyaku_kaijo_memo[n]

def nCr(n,r):
  if(n == r):
    return 1
  if(n < r or r < 0):
    return 0
  ret = 1
  ret = ret * kaijo(n) % MOD
  ret = ret * gyaku_kaijo(r) % MOD
  ret = ret * gyaku_kaijo(n-r) % MOD
  return ret

#############
# Main Code #
#############

N = int(input())

dic = [[0 for i in range(10)] for j in range(10)]
for i in range(1,N+1):
  top = int(str(i)[0])
  bottom = int(str(i)[-1])
  dic[top][bottom] += 1

ans = 0
for i in range(10):
  for j in range(10):
    ans += dic[i][j]*dic[j][i]

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

import math

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

_max = 0
for i in range(n + 1):
    val = math.floor((a * i) / b) - (a * math.floor(i / b))
    _max = max(_max, val)

print(_max)

### FIXED CODE ###

import math

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

k = min(n, b - 1)
print(math.floor(a * k / b) - a * math.floor(k / b))
### BUGGY CODE ###

import math
n=int(input())
a=list(map(int,input().split()))
m=math.ceil(math.log(max(1,max(a)),2))

ans=0
for i in range(m):
  sum1=sum((a[j]>>i)&1 for j in range(n))
  sum0=n-sum1
  ans+=2**i*sum1*sum0

print(ans%(10**9+7))

### FIXED CODE ###

import math
n=int(input())
al=list(map(int,input().split()))
a=['{:060b}'.format(x) for x in al]
a=''.join(a)

m=math.ceil(math.log(max(1,max(al)),2))

ans=0
for i in range(m):
  sum1=a[59-i::60].count('1')
  sum0=n-sum1
  ans+=2**i*sum1*sum0

print(ans%(10**9+7))
### BUGGY CODE ###

import sys
input=sys.stdin.readline
import itertools

def main():
    K,S = map(int, input().split())
    c = itertools.product([i for i in range(K+1)], repeat=3)
    n = 0
    for i in c:
        if sum(i) == S:
            n += 1
    print(n)

if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input=sys.stdin.readline

def main():
    K,S = map(int, input().split())
    n = 0
    for i in range(K+1):
        for j in range(K+1):
            if S-i-j >= 0 and S-i-j <= K:
                n += 1
    print(n)

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

from collections import deque

h,w,m = map(int,input().split())
Ms = []

h_scores = [0 for i in range(h)]
w_scores = [0 for i in range(w)]

record = set()

for i in range(m):
  h,w = map(int,input().split())
  record.add((h-1,w-1))
  h_scores[h-1] += 1
  w_scores[w-1] += 1

max_h = max(h_scores)
max_w = max(w_scores)
max_h_poss = [i for i,v in enumerate(h_scores) if v == max_h]
max_w_poss = [i for i,v in enumerate(w_scores) if v == max_w]

out_pos_count = 0 

c = False

for i in max_h_poss:
    for j in max_w_poss:
        if (i,j) not in record:
            c = True        

if c:
    print(max(h_scores) + max(w_scores))
else:
    print(max(h_scores) + max(w_scores)-1)

### FIXED CODE ###

from collections import deque

h,w,m = map(int,input().split())
Ms = []

h_scores = [0 for i in range(h)]
w_scores = [0 for i in range(w)]

record = set()

for i in range(m):
  h,w = map(int,input().split())
  record.add((h-1,w-1))
  h_scores[h-1] += 1
  w_scores[w-1] += 1

max_h = max(h_scores)
max_w = max(w_scores)
max_h_poss = [i for i,v in enumerate(h_scores) if v == max_h]
max_w_poss = [i for i,v in enumerate(w_scores) if v == max_w]

out_pos_count = 0 

c = False

for i in max_h_poss:
    for j in max_w_poss:
        if (i,j) not in record:
            c = True
            break        

if c:
    print(max(h_scores) + max(w_scores))
else:
    print(max(h_scores) + max(w_scores)-1)
### BUGGY CODE ###

N,Q=map(int,input().split())
import sys
def input(): return sys.stdin.readline().strip()
STX=[list(map(int,input().split())) for i in range(N)]
D=[int(input()) for i in range(Q)]
X=[]
for s,t,x in STX:
    X.append((s-x,1,x))
    X.append((t-x,-1,x))
X.sort(key=lambda x:x[0])
a=0
k=[]
for x in X:
    while a<Q and D[a]<x[0]:
        if len(k)>0:
            print(min(k))
        else:
            print(-1)
        a+=1
    if x[1]==1:
        k.append(x[2])
    else:
        k.remove(x[2])
while a<Q:
    print(-1)
    a+=1

### FIXED CODE ###

N,Q=map(int,input().split())
import sys
def input(): return sys.stdin.readline().strip()
STX=[list(map(int,input().split())) for i in range(N)]
D=[int(input()) for i in range(Q)]
X=[]
for s,t,x in STX:
    X.append((s-x,1,x))
    X.append((t-x,-1,x))
X.sort(key=lambda x:x[0])
a=0
k=[]
from heapq import heappop,heappush
kd={}
for x in X:
    while a<Q and D[a]<x[0]:
        if len(k)>0:
            print(k[0])
        else:
            print(-1)
        a+=1
    if x[1]==1:
        heappush(k,x[2])
        if x[2] in kd:
            kd[x[2]]=0
    else:
        kd[x[2]]=1
        while len(k)>0 and k[0] in kd and kd[k[0]]==1:
            heappop(k)
while a<Q:
    print(-1)
    a+=1
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
MIN = float('inf')
for i in range(1,N):
    MIN = min(MIN,abs(sum(A[:i])-sum(A[i:])))
print(MIN)

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
LEFT = A[0]
RIGHT = sum(A[1:])
MIN = abs(LEFT-RIGHT)
for i in range(1,N-1):
    LEFT += A[i]
    RIGHT -= A[i]
    MIN = min(MIN,abs(LEFT-RIGHT))
print(MIN)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
divisor = 1000000007
# 文字列を一文字ずつのリストに代入 test は['t', 'e', 's', 't']
s = list(input())
t = [0]*len(s)

for i in range( len(s) ):
    if s[i] == '?':
#        t.append(-1)
        t[i]=-1
    else:
#        t.append(int(s[i]))
        t[i]=int(s[i])

dp = [[0 for i in range(13)] for i in range(100005)]
dp[0][0]=1
for i in range(len(s)):
    for j in range(10):
        if t[i] == -1 or t[i] == j:
            for k in range(13):
                dp[i+1][(k*10+j)%13] += dp[i][k]
    for j in range(13):
        dp[i+1][j] = dp[i+1][j] % divisor

print(dp[len(s)][5])


### FIXED CODE ###

# -*- coding: utf-8 -*-
# 
import math
import sys
import itertools
divisor = 1000000007
# 文字列を一文字ずつのリストに代入 test は['t', 'e', 's', 't']
s = list(input())
t = []

for i in range( len(s) ):
    if s[i] == '?':
        t.append(-1)
    else:
        t.append(int(s[i]))

dp = [[0 for i in range(13)] for i in range(100005)]
dp[0][0]=1
for i in range(len(s)):
    for j in range(10):
        if t[i] == -1 or t[i] == j:
            for k in range(13):
                dp[i+1][(k*10+j)%13] += dp[i][k]
    for j in range(13):
        dp[i+1][j] = dp[i+1][j] % divisor

print(dp[len(s)][5])
### BUGGY CODE ###

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

ans = float('inf')
for i in range(N-1):
    tmp = abs(sum(L[:i+1])-sum(L[i+1:]))
    ans = min(ans, tmp)
print(ans)

### FIXED CODE ###

from numpy import cumsum

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

all = sum(L)
cum = list(cumsum(L))

ans = float('inf')
for i in range(N-1):
    tmp = abs(cum[i]-(all-cum[i]))
    ans = min(ans, tmp)
print(ans)
### BUGGY CODE ###

# coding: utf-8
import sys
#from operator import itemgetter
sysread = sys.stdin.buffer.readline
read = sys.stdin.buffer.read
#from heapq import heappop, heappush
#from collections import defaultdict
sys.setrecursionlimit(10**7)
#import math
from itertools import product#accumulate, combinations, product
#import bisect# lower_bound etc
import numpy as np
#from copy import deepcopy
#from collections import deque
def run():
    H,W,K = map(int, sysread().split())
    S = []
    for i in range(H):
        S.append(list(map(int, list(input()))))
    S = np.array(S)
    ret = float('inf')
    for w in range(1, W):
        S[:,w] += S[:,w-1]
    for idxes_ in product((0,1), repeat=H-1):
        l = 0
        r = 1
        idxes = [0]
        for i, val in enumerate(idxes_, 1):
            if val == 1:
                idxes.append(i)
        idxes.append(H)
        min_cut = len(idxes) - 2
        while r <= W:
            for i in range(len(idxes)-1):
                cri = S[idxes[i]:idxes[i+1], r-1].sum()
                if l > 0:
                    cri -= S[idxes[i]:idxes[i+1], l-1].sum()
                if cri > K:
                    r -= 1
                    if l == r:
                        min_cut = float('inf')
                        r = W+1
                        break
                    l = r
                    min_cut += 1
                    break
            r += 1
        ret = min(ret, min_cut)

    print(ret)




if __name__ == "__main__":
    run()


### FIXED CODE ###

# coding: utf-8
from itertools import combinations as combs

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

def cut_sum(arr, x1, x2, y):
  ret = 0
  for i in range(x1, x2):
    ret += arr[i][y]
  return ret

row_idxes = list(range(1,H))
min_val = float('inf')

for n_rows in range(H):
  for row_set in combs(row_idxes, n_rows):
    count = len(row_set)
    row_lines = [0] + list(row_set)+ [H]
    col1, col2 = 0, 1
    sums = [0] * (len(row_lines) - 1)
    while col2 <= W:
      row1 = 0
      for box, row2 in enumerate(row_lines[1:]):
        sums[box] += cut_sum(arr, row1, row2, col2-1)
        if sums[box] > K:
          if (col2 - col1) == 1:
            count = float('inf')
            break
          count += 1
          col1 = col2 - 1
          col2 -= 1
          sums = [0] * (len(row_lines) - 1)
          break
        row1 = row2
      if count >= min_val:
        break
      col2 += 1
    
    if min_val > count:
      min_val = count
print(min_val)
### BUGGY CODE ###

n = int(input())
r = 1
for i in range(2, n+1):
    r *= i%(10**9+7)
print(r%(10**9+7))

### FIXED CODE ###

n = int(input())
r = 1
for i in range(2, n+1):
    r *= i
    r %= 10**9+7
print(r)
### BUGGY CODE ###

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

order = [0] * N
flag = 0
for i in range(0, N):
    flag = A.index(min(A))
    order[i] = flag + 1
    A[flag] = N + 1

for s in order:
    print(s, end =" ")


### FIXED CODE ###

N = int(input()) 
A = list(map(int,input().split()))
 
lis = []
for i in range(N):
    lis.append ([A[i],i+1])
 
lis.sort()
ans = []
for i in range(N):
    ans.append(lis[i][1])
 
print(" ".join(map(str,ans)))
### BUGGY CODE ###

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

list2 = []
for i in range(N):
    if (list1[i] in list2) == True:
        list2.remove(list1[i])
    else:
        list2.append(list1[i])

print(len(list2))

### FIXED CODE ###

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

dict2 = {}
for i in list1:
    if(i in dict2):
        dict2[i] += 1
    else:
        dict2[i] = 1

count = 0;
for i in dict2.values():
    if i % 2 == 1:
        count += 1
print(count)
### BUGGY CODE ###

n,a=int(input()),map(int,input().split());c=[0]*3;l=[1.0/i for i in range(1,n+1)]
for i in a:c[i-1]+=1
x,y,z=c;dp=[[[0]*(z+2) for i in range(n-x+2)]for i in range(n+2)]
for k in range(z+1):
  for j in range(n-x-k+1):
    for i in range(n-k-j+1):
      if i+j+k:dp[i][j][k]=(n+dp[i-1][j][k]*i+dp[i+1][j-1][k]*j+dp[i][j+1][k-1]*k)*l[i+j+k-1]
print(dp[x][y][z])

### FIXED CODE ###

n,a=int(input()),map(int,input().split());c=[0]*3
for i in a:c[i-1]+=1
x,y,z=c;dp=[[[None]*(z+2) for i in range(n-x+2)]for i in range(n+2)];dp[0][0][0]=0
for k in range(z+1):
  for j in range(n-x-k+1):
    for i in range(n-k-j+1):
      if i+j+k:dp[i][j][k]=((dp[i-1][j][k]*i if i else 0)+(dp[i+1][j-1][k]*j if j else 0)+(dp[i][j+1][k-1]*k if k else 0)+n)/(i+j+k)
print(dp[x][y][z])