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

N = int(input())
a = list(map(int,input().split()))
I = 0
J = 0
K = 0
for i in range(N):
    if a[i] == 1:
        I += 1
    if a[i] == 2:
        J += 1
    if a[i] == 3:
        K += 1

dp = [[[0]*(N+1) for _ in range(N+1)] for _ in range(N+1)]
for k in range(K+1):
    for j in range(J+K+1):
        if j+k > N:
            break
        for i in range(N+1):
            if i+j+k > N:
                break
            if i > 0:
                dp[i][j][k] += i*dp[i-1][j][k]
            if j > 0:
                dp[i][j][k] += j*dp[i+1][j-1][k]
            if k > 0:
                dp[i][j][k] += k*dp[i][j+1][k-1]
            if i+j+k > 0:
                dp[i][j][k] += N
                dp[i][j][k] /= i+j+k
print(dp[I][J][K])

### FIXED CODE ###

N = int(input())
a = list(map(int,input().split()))
I = 0
J = 0
K = 0
for i in range(N):
    if a[i] == 1:
        I += 1
    if a[i] == 2:
        J += 1
    if a[i] == 3:
        K += 1

dp = [[[0.0]*(N+2) for _ in range(N+2)] for _ in range(N+2)]
for k in range(K+1):
    for j in range(J+K+1):
        if j+k > N:
            break
        for i in range(N+1):
            S = i+j+k
            if S > N:
                break
            if S == 0:
                continue
            dp[i][j][k] = (i*dp[i-1][j][k]+j*dp[i+1][j-1][k]+k*dp[i][j+1][k-1]+N)/S
print(dp[I][J][K])
### BUGGY CODE ###

import itertools
k,s=map(int,input().split())
x=[x for x in range(0,k+1)]
y=[y for y in range(0,k+1)]
z=[z for z in range(0,k+1)]
data=list(itertools.product(x,y,z))
ans=[sum(i) for i in (data)]
print(ans.count(s))


### FIXED CODE ###

k, s = map(int, input().split())
ans = 0
for x in range(k+1):
    for y in range(k+1):
        z = s-x-y
        if 0 <= z <= k and x+y+z == s:
            ans += 1
print(ans)
### BUGGY CODE ###

def main():
    S = input()
    Q = int(input())
    revFlag = False
    for i in range(Q):
        tmp = list(input().split())
        if tmp[0] == "1":
            if revFlag:
                revFlag = False
            else:
                revFlag = True
        else:
            if tmp[1] == "1":
                if revFlag:
                    S += tmp[2]
                else:
                    S = tmp[2] + S
            else:
                if revFlag:
                    S = tmp[2] + S
                else:
                    S += tmp[2]
    if revFlag:
        S = list(S)
        S.reverse()
        print("".join(S))
    else:
        print(S)


if __name__ == '__main__':
    main()

### FIXED CODE ###

from collections import deque

def main():
    S = deque(input())
    Q = int(input())
    revFlag = False
    for i in range(Q):
        tmp = list(input().split())
        if tmp[0] == "1":
            if revFlag:
                revFlag = False
            else:
                revFlag = True
        else:
            if tmp[1] == "1":
                if revFlag:
                    S.append(tmp[2])
                else:
                    S.appendleft(tmp[2])
            else:
                if revFlag:
                    S.appendleft(tmp[2])
                else:
                    S.append(tmp[2])
    if revFlag:
        S = list(S)
        S.reverse()
        print("".join(S))
    else:
        S = list(S)
        print("".join(S))


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

import sys
sys.setrecursionlimit(10**9)
input = sys.stdin.readline
N, M = map(int, input().split())
G = [[] for _ in [0]*N]

for _ in [0]*M:
    a, b, d = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append((b, d))
    G[b].append((a, -d))

visited = [False]*N
X = [None]*N


def isok(i, x=0):
    visited[i] = True
    X[i] = x

    for j, d in G[i]:
        if X[j] is not None and X[j] != x+d:
            return False
        elif visited[j]:
            continue
        if not isok(j, x+d):
            return False
    return True


for i in range(N):
    if visited[i]:
        continue
    if not isok(i):
        print('No')
        break
else:
    print('Yes')


### FIXED CODE ###

import sys
sys.setrecursionlimit(2*10**6)
input = sys.stdin.readline
N, M = map(int, input().split())
G = [[] for _ in [0]*N]
for _ in [0]*M:
    a, b, d = map(int, input().split())
    a -= 1
    b -= 1
    G[a].append((b, d))
    G[b].append((a, -d))

X = [None]*N

def dfs(i, x=0):
    for j, d in G[i]:
        if X[j] is None:
            X[j] = x+d
            dfs(j, x+d)
        elif X[j] != x+d:
            print('No')
            exit()

for i in range(N):
    if X[i] is not None:
        continue
    X[i] = 0
    dfs(i)
print('Yes')
### BUGGY CODE ###

n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
ans=0
asum=0
bsum=0
for j in range(m):
	bsum+=b[j]
	if asum+bsum<=k:
		ans=max(ans,(j+1))
for i in range(n):
	asum+=a[i]
	bsum=0
	if asum+bsum<=k:
		ans=max(ans,(i+1))
	for j in range(m):
		bsum+=b[j]
		if asum+bsum<=k:
			ans=max(ans,(i+1)+(j+1))
print(ans)

### FIXED CODE ###

n,m,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
asum=[0]
bsum=[0]
current=0
for i in range(n):
  current+=a[i]
  asum.append(current)
current=0
pointer=0
for i in range(m):
  current+=b[i]
  bsum.append(current)
for i in range(n+1):
  if asum[i]>k:
    pointer=i-1
    break
  if i==n:
    pointer=n
ans=pointer
bpointer=0
for i in range(pointer,-1,-1):
  while bpointer<m+1 and bsum[bpointer]+asum[i]<=k:
    bpointer+=1
    if bpointer==m+1:
      break
  bpointer-=1
  ans=max(ans,i+bpointer)
print(ans)
### BUGGY CODE ###

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

for i in range(b):
    d, e = map(int, input().split())
    f = c[d-1:e]
    print((len(f) - len(f.replace("AC", ""))) // 2)


### FIXED CODE ###

a, b = map(int, input().split())
c = input()
d = [0] * a
e = 0
for i in range(1, a):
    if c[i] == "C" and c[i-1] == "A":
        e += 1
    d[i] = e
for i in range(b):
    f, g = map(int, input().split())
    print(d[g-1]-d[f-1])
### BUGGY CODE ###

M = 10 ** 9 + 7


cache = {}

# Combination under a prime modulo: nCk % p
def combmod(n, k, p=M):
    if k > n:
        return 0
    if k > n - k:
        k = n - k
    if (n, k) in cache:
        return cache[n, k]
    num, den = 1, 1
    for i in range(k):
        num = num * (n - i) % p
        den = den * (i + 1) % p
    # By Fermat's little theorem,
    # a^(p-1) ≡ 1 mod p
    # i.e. a^(p-2) ≡ a^(-1) mod p
    inv_dev = pow(den, p - 2, p)
    res = num * inv_dev % p
    cache[n, k] = res
    return res


n = int(input())
a = list(map(int, input().split()))
assert len(a) == n + 1

b = [None] * (n + 1)
d1, d2 = -1, -1
for i in range(n + 1):
    if b[a[i]] is None:
        b[a[i]] = i
    else:
        d1 = b[a[i]]
        d2 = i
        break
assert d1 >= 0 and d2 >= 0 and a[d1] == a[d2]

for w in range(1, n + 2):
    ans = combmod(n + 1, w) - combmod(n - d2 + d1, w - 1)
    print(ans % M)


### FIXED CODE ###

import sys

input = sys.stdin.readline
M = 10 ** 9 + 7

n = int(input())
a = list(map(int, input().split()))
assert len(a) == n + 1

b = [None] * (n + 1)
d1, d2 = -1, -1
for i in range(n + 1):
    if b[a[i]] is None:
        b[a[i]] = i
    else:
        d1 = b[a[i]]
        d2 = i
        break
assert d1 >= 0 and d2 >= 0 and a[d1] == a[d2]


a, b, ik = n + 1, 1, 1
for k in range(1, n + 2):
    ans = (a - b) % M
    print(ans)
    b = b * (n + 1 - d2 + d1 - k) * ik % M
    ik = pow(k + 1, M - 2, M)
    a = a * (n + 1 - k) * ik % M
### BUGGY CODE ###

n = int(input())
for a in range(-1000,1000):
    for b in range(-1000, 1000):
        if a**5 - b**5 == n:
            print(a, b)
            break;


### FIXED CODE ###

# unihernandez22
# https://atcoder.jp/contests/abc166/tasks/abc166_d
# math
n = int(input())
for a in range(n):
    breaked = True
    for b in range(-1000, 1000):
        if a**5 - b**5 == n:
            print(a, b)
            break;
    else:
        breaked = False
    if breaked:
        break
### BUGGY CODE ###

abcd = input().split(" ")
count = 0

for mizuki in range(int(abcd[0]), int(abcd[1]) + 1):
  if mizuki % int(abcd[2]) == 0:
    count += 1
  elif mizuki % int(abcd[3]) == 0:
    count += 1
    
print(int(abcd[1]) - int(abcd[0]) + 1 - count)
    

### FIXED CODE ###

import fractions

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

def howmany(num, div1, div2):
  tsumugi = num // div1
  matsuri = num // div2
  kaori = num // (div1 * div2 //fractions.gcd(div1, div2))
  mizuki = num - tsumugi - matsuri + kaori
  return mizuki

A = howmany(a - 1, c, d)
B = howmany(b, c, d)

ans = B - A

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

# @author 

import sys

class JSushi:
    def solve(self):
        n = int(input())
        a = [int(_) for _ in input().split()]

        u, v, w = a.count(1), a.count(2), a.count(3)

        dp = [[[0] * (n + 2) for _ in range(n + 2)] for _ in range(n + 2)]
        for k in range(n + 1):
            for j in range(n + 1):
                for i in range(n + 1):
                    if i == j == k == 0:
                        continue
                    s = i + j + k
                    dp[i][j][k] += (dp[i][j + 1][k - 1] + 1) * k / s
                    dp[i][j][k] += (dp[i + 1][j - 1][k] + 1) * j / s
                    dp[i][j][k] += (dp[i - 1][j][k] + 1) * i / s
                    dp[i][j][k] += (n - s) / s

        print(dp[u][v][w])


solver = JSushi()
input = sys.stdin.readline

solver.solve()


### FIXED CODE ###

# @author 

import sys

class JSushi:
    def solve(self):
        n = int(input())
        a = [int(_) for _ in input().split()]

        u, v, w = a.count(1), a.count(2), a.count(3)

        dp = [[[0] * (n + 2) for _ in range(n + 2)] for _ in range(n + 2)]
        for k in range(n + 1):
            for j in range(n + 1 - k):
                for i in range(n + 1 - j - k):
                    if i == j == k == 0:
                        continue
                    s = i + j + k
                    x = 0
                    x += dp[i][j + 1][k - 1] * k
                    x += dp[i + 1][j - 1][k] * j
                    x += dp[i - 1][j][k] * i
                    x += n
                    x /= s
                    dp[i][j][k] = x

        print(dp[u][v][w])


solver = JSushi()
input = sys.stdin.readline

solver.solve()
### BUGGY CODE ###

N = int(input())
S = input()

result = 0
for i in range(N - 1, 0, -1):
    if i < result:
        break
    t = 0
    for j in range(N - i):
        if S[j] == S[j+i]:
            t += 1
            if t > result:
                result = t
            if t == i:
                break
        else:
            t = 0

print(result)


### FIXED CODE ###

N = int(input())
S = input()

result = 0
for i in range(N - 1, 0, -1):
    if i <= result:
        break
    t = 0
    for j in range(N - i):
        if S[j] == S[j+i]:
            t += 1
            if t > result:
                result = t
            if result == i:
                break
        else:
            t = 0

print(result)
### BUGGY CODE ###

from sys import stdin, setrecursionlimit

setrecursionlimit(1000000)


def main():

    def read_tree(n):
        tree = [[] for _ in range(n + 1)]
        for _ in range(n - 1):
            a, b = [int(x) for x in stdin.readline().split()]
            tree[a].append(b)
        return tree

    def walk(p, i, tree, sibs):
        sibs[p].add(i)
        for sib in tree[i]:
            walk(p, sib, tree, sibs)

    def make_sibs(n, tree):
        sibs = [set() for _ in range(n + 1)]
        for p in range(1, n + 1):
            walk(p, p, tree, sibs)
        return sibs

    n, q = [int(x) for x in stdin.readline().split()]

    tree = read_tree(n)
    sibs = make_sibs(n, tree)
    cnt = [0] * (n + 1)

    for _ in range(q):
        p, x = [int(x) for x in stdin.readline().split()]
        for sib in sibs[p]:
            cnt[sib] += x

    for i in range(1, n + 1):
        print(cnt[i], end=" ")


main()


### FIXED CODE ###

from sys import stdin, setrecursionlimit

setrecursionlimit(1000000)


def main():
    def read_tree(n):
        parents = [0 for _ in range(n + 1)]
        for _ in range(n - 1):
            a, b = [int(x) for x in input().split()]
            parents[b] = a
        return parents

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

    parents = read_tree(n)
    cnt = [0] * (n + 1)

    for _ in range(q):
        p, x = [int(x) for x in input().split()]
        cnt[p] += x
    
    for i in range(1, n + 1):
        cnt[i] += cnt[parents[i]]

    for i in range(1, n + 1):
        print(cnt[i], end=" ")


main()
### BUGGY CODE ###

S = str(input())
Smae = S
while True:
    S = S.replace('01', '')
    S = S.replace('10', '')
    if '01' not in S and '10' not in S:
        break
print(len(Smae) - len(S))

### FIXED CODE ###

S = str(input())

C0, C1 = 0, 0
for i in S:
    if i == "0":
        C0 += 1
    else:
        C1 += 1
mini = min(C0, C1)
print(2 * mini)
### BUGGY CODE ###

n=int(input())
a=(input().split())
for i in range(n):
    x=0
    for j in range(n):
        for k in range(n):
            if j>k:
                if a[j]==a[k] and j!=i and k!=i:
                    x=x+1
    print(x)


### FIXED CODE ###

def main():
    from collections import Counter
    n=int(input())
    a=list(map(int,input().split()))

    ctr = Counter(a)
    frm_n = sum(x * (x - 1) // 2 for x in ctr.values())

    ans = []
    for x in a:
        ans.append(frm_n - ctr[x] + 1)

    print(*ans, sep='\n')


if __name__ == '__main__':
    main()

# import sys
# input = sys.stdin.readline
# 
# sys.setrecursionlimit(10 ** 7)
# 
# (int(x)-1 for x in input().split())
# rstrip()
#
# def binary_search(*, ok, ng, func):
#     while abs(ok - ng) > 1:
#         mid = (ok + ng) // 2
#         if func(mid):
#             ok = mid
#         else:
#             ng = mid
#     return ok
### BUGGY CODE ###

n,q=map(int,input().split())
s=str(input())
l=[0]*q
r=[0]*q
for i in range(q):
        l[i],r[i]=map(int,input().split())

t=s.replace('A'+'C','*_')
a=[0]
for i in range(n):
        if t[i]=='*':
                a.append(i+1)
a.append(len(s))
for i in range(q):
        count=0
        for j in range(len(a)):
                if l[i]<=a[j]<=r[i]-1:
                        count+=1
        print(count)




### FIXED CODE ###

import sys
input = sys.stdin.readline
n,q=map(int,input().split())
s=str(input())

t=[0]*n
for i in range(n-1):
        t[i+1]=t[i]+(1 if s[i:i+2]=='AC' else 0)
for j in range(q):
        l,r=map(int,input().split())
        print(t[r-1]-t[l-1])
### BUGGY CODE ###

n, h = [int(t) for t in input().split()]
aa = []
bb = []
for _ in range(n):
    a, b = [int(t) for t in input().split()]
    aa.append(a)
    if b > a:
        bb.append(b)
aa.sort()
bb.sort()

cnt = 0
while h > 0:
    if not bb:
        cnt += (h - 1) // aa[-1] + 1
        break
    elif bb[-1] > aa[-1]:
        h -= bb.pop()
    else:
        h -= aa[-1]
    cnt += 1
print(cnt)


### FIXED CODE ###

n, h = [int(t) for t in input().split()]
aa = []
bb = []
for _ in range(n):
    a, b = [int(t) for t in input().split()]
    aa.append(a)
    if b > a:
        bb.append(b)
aa.sort()
bb.sort()

cnt = 0
while h > 0:
    if not bb or aa[-1] >= bb[-1]:
        cnt += (h - 1) // aa[-1] + 1
        break
    else:
        h -= bb.pop()
    cnt += 1
print(cnt)
### BUGGY CODE ###

import math
a, b = list(map(int, input().split(' ')))
def gcd(l, s):
    return s if l % s == 0 else gcd(s, l % s)
g = gcd(a, b)
primes = []
if g % 2 == 0:
    primes.append(2)
def prime(n):
    for i in range(len(primes)):
        if n % primes[i] == 0:
            return False
    return True
def make():
    for i in range(3, g + 1, 2):
        if prime(i):
            primes.append(i)

make()

print(len([i for i in primes if g % i == 0]) + 1)

### FIXED CODE ###

a, b = list(map(int, input().split(' ')))
def gcd(l, s):
  return l if s == 0 else gcd(s, l % s)

temp = gcd(a, b)

ans = 0
for i in range(2,1000000):
  if temp % i == 0:
    ans += 1
    while temp % i == 0:
      temp = temp // i
  if temp == 1:
    break
if temp != 1:
  ans += 1

print(ans+1)
### BUGGY CODE ###

N = int(input())
lis = list(map(int, input().split()))
c = 0
if N == 1:
  print(lis[0])
else:
  for i in range(N):
    f = True
    for j in range(i):
      if lis[i] > lis[j]:
        f = False
    if f:
      c += 1
  print(c)

### FIXED CODE ###

N = int(input())
lis = list(map(int, input().split()))
c = 1
j_min = lis[0]
if N == 1:
  print(c)
else:
  for i in range(1,N):
    if j_min > lis[i]:
        c += 1
        j_min = lis[i]
  print(c)
### BUGGY CODE ###

from collections import*
n,x,y=map(int,input().split())
e=[[]for _ in range(n)]
for i in range(n-1):
    e[i]+=i+1,
    e[i+1]+=i,
e[x-1]+=y-1,
e[y-1]+=x-1,
a=[0]*n
for s in range(n):
    d=[-1]*n
    d[s]=0
    q=deque([s])
    while q:
        v=q.popleft()
        for w in e[v]:
            if d[w]<0:
                d[w]=d[v]+1
                q+=w,
    for i in d:a[i]+=1
print(*[i//2for i in a[1:]])

### FIXED CODE ###

from collections import*
n,x,y=map(int,input().split())
e=[[]for _ in range(n)]
for i in range(n-1):
    e[i]+=i+1,
    e[i+1]+=i,
e[x-1]+=y-1,
e[y-1]+=x-1,
a=[0]*n
for s in range(n):
    d=[-1]*n
    d[s]=0
    q=deque([s])
    while q:
        v=q.popleft()
        for w in e[v]:
            if d[w]<0:
                d[w]=d[v]+1
                q+=w,
    for i in d:a[i]+=1
print(*[i//2for i in a[1:]])
### BUGGY CODE ###

N = int(input())
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

max_diff = -10000000
for selection in range(1 << N):
    v_tmp = 0
    c_tmp = 0
    for idx in range(N):
        if (selection >> idx) & 1:
            v_tmp += v_list[idx]
            c_tmp += c_list[idx]
    max_diff = max(max_diff, v_tmp - c_tmp)

print(max_diff)

### FIXED CODE ###

from itertools import combinations

N = int(input())
v_list = list(map(int, input().split()))
c_list = list(map(int, input().split()))

max_diff = -10000000
for n_selection in range(0, N+1):
    v_selected = list(combinations(v_list, n_selection))
    c_selected = list(combinations(c_list, n_selection))
    if n_selection == 0:
        max_diff = max(max_diff, 0)
    for i in range(len(v_selected)):
        X = sum(v_selected[i])
        Y = sum(c_selected[i])
        max_diff = max(max_diff, X - Y)

print(max_diff)
### BUGGY CODE ###

n,k=list(map(int,input().split()))
p=list(map(int,input().split()))
ans=0
for i in range(n-k+1):
  ans=max(ans,sum(p[i:k+i]))
print((ans+k)/2)

### FIXED CODE ###

n,k=list(map(int,input().split()))
p=list(map(int,input().split()))
s=sum(p[0:k])
ans=(k+s)/2

for l in range(n-k):
  s-=p[l]
  s+=p[l+k]
  ans=max(ans,(k+s)/2)
print(ans)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 1
for i in range(n):
    ans = ans * a[i]
    if a[i] == 0:
        print(0)
        exit()

if ans <= 10**18:
    print(ans)
else:
    print(-1)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
ans = 1
if a.count(0):
    print(0)
    exit()

for i in range(n):
    ans = ans * a[i]
    if ans > 10**18:
        print(-1)
        exit()

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

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

for i in range(M):
  A_max = max(A)
  if A_max==0:break
  A[A.index(A_max)] = A_max//2
print(sum(A))

### FIXED CODE ###

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

while M>0:
  A = sorted(A, reverse=True)
  a_ = A[0]//2
  for i,a_i in enumerate(A):
    if a_i > a_ and M>0:
      A[i] = a_i//2
      M -= 1
    else: break
  if a_==0: break
print(sum(A))
### BUGGY CODE ###

def move_people(city, nums_city_people, nums_transportation_seat):
    if nums_city_people[city] - nums_transportation_seat[city] >= 0:
        nums_city_people[city] -= nums_transportation_seat[city]
        nums_city_people[city+1] += nums_transportation_seat[city]
    else:
        nums_city_people[city+1] += nums_city_people[city]
        nums_city_people[city] = 0


NUM_CITIES = 6
NUM_TRANSPORTATION = 5

nums_city_people = [int(input())] + [0] * (NUM_CITIES-1)
nums_people_having_moved = list(reversed(nums_city_people))
nums_transportation_seat = [int(input()) for i in range(NUM_TRANSPORTATION)]
result = 0

while nums_city_people != nums_people_having_moved:
    result += 1
    for city in reversed(range(NUM_CITIES-1)):
        move_people(city, nums_city_people, nums_transportation_seat)

print(result)

### FIXED CODE ###

TRANSPORTATION_COUNT = 5

people_count = int(input())
capacity_counts = [int(input()) for i in range(TRANSPORTATION_COUNT)]
result = people_count // min(capacity_counts)

if people_count % min(capacity_counts) > 0:
    result += TRANSPORTATION_COUNT
else:
    result += TRANSPORTATION_COUNT - 1
    
print(result)
### BUGGY CODE ###

from bisect import bisect_left
from bisect import bisect_right

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

ans = 0

while a:
    s = a.pop()
    m = 1
    while m <= s:
        m *= 2
    ind = bisect_right(a, m-s)
    if ind == 0:
        continue
    if a[ind-1] == m-s:
        a.pop(ind-1)
        ans += 1

print(ans)


### FIXED CODE ###

from bisect import bisect_left
from bisect import bisect_right

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

ans = 0
visited = [False]*n

while a:
    s = a.pop()
    if visited.pop():
        continue
    m = 1
    while m <= s:
        m *= 2
    r = bisect_right(a, m-s)
    l = bisect_left(a, m-s)
    for x in range(l, r)[::-1]:
        if not visited[x]:
            visited[x] = True
            ans += 1
            break

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

import numpy as np
 
N = int(input())
li = list(map(int,input().split()))
 
r = []
result = ""
 
for i in range(1,N+1):
    a = li.index(i)
    result = result + str(a+1) + " "
    
print(result)

### FIXED CODE ###

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

r = [0]*N

for index in range(N):
    l = li[index]
    r[l-1] = str(index+1)

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

import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    sys.setrecursionlimit(10**7)
    INF = 10**18
    MOD = 10**9 + 7
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    _LI = lambda : [-int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())
    SI = lambda : sys.stdin.readline().rstrip()
    DD = ((1,0),(0,1),(-1,0),(0,-1))

    N = LI()
    A = LI()

    y = [0] * (10**6 + 1)
    for i in A:
        y[i] += 1

    ans = 0
    for i in A:
        if i > 1:
            if y[1] : continue
        if y[i] > 1: continue

        f = 1
        for j in range(2,int(math.sqrt(i))+1):
            if i % j == 0 and (y[j] or y[i//j]):
                f = 0
                break

        ans += f

    print(ans)
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys,queue,math,copy,itertools,bisect,collections,heapq

def main():
    LI = lambda : [int(x) for x in sys.stdin.readline().split()]
    NI = lambda : int(sys.stdin.readline())

    N = NI()

    y = [0] * (10**6 + 1)
    z = [0] * (10**6 + 1)
    A = []
    for x in sys.stdin.readline().split():
        x = int(x)
        A.append(x)
        y[x] += 1
        if y[x] == 1:
            c = x * 2
            while c <= 10**6:
                z[c] = 1
                c += x

    ans = 0
    for i in range(N):
        x = A[i]
        if y[x] > 1: continue

        if z[x] == 0:
            ans += 1

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

N,K=map(int,input().split())
h=list(map(int,input().split()))

DP=[10000000000]*N

DP[0]=0
for i in range(1,N):
    temp=[]
    if i<K:
        for j in range(i):
            temp.append(DP[j]+abs(h[j]-h[i]))
    else:
        for j in range(1,K+1):
            temp.append(DP[i-j]+abs(h[i]-h[i-j]))
    DP[i]=min(temp)

print(DP[N-1])

### FIXED CODE ###

N,K=map(int,input().split())
h=list(map(int,input().split()))

DP=[10000000000]*N

DP[0]=0
for i in range(1,N):
    temp=[]
    if i<K:
        for j in range(i):
            temp.append(DP[j]+abs(h[j]-h[i]))
    else:
        for j in range(1,K+1):
            temp.append(DP[i-j]+abs(h[i]-h[i-j]))
    DP[i]=min(temp)

print(DP[N-1])