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

n = int(input())
a = list(map(int,input().split()))
ans = []
for i in range(len(a)):
    for j in range(len(a)):
        if i+1 == a[j]:
            ans.append(j+1)
            break
print(*ans)

### FIXED CODE ###

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

n = int(input())
s = input()
x = [0,0,0]
for i in range(n):
    x[ord(s[i])%3] += 1
 
ans = x[0]*x[1]*x[2]

for i in range(n):
    for j in range(i+1,n):
        if 2*j-i >= n:
            continue
        k = 2*j-i
        if s[i] != s[j]:
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans -= 1
 
print(ans)

### FIXED CODE ###

n = int(input())
s = input()
r = 0
b = 0
g = 0
for i in range(n):
    if s[i] == 'R':
        r += 1
    elif s[i] == 'B':
        b += 1
    else:
        g += 1

ans = r*g*b

for i in range(n):
    for j in range(i+1,n):
        if 2*j-i >= n:
            continue
        k = 2*j-i
        if s[i] != s[j]:
            if s[i] != s[j] and s[i] != s[k] and s[j] != s[k]:
                ans -= 1

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

n,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
a.sort(reverse=True)
b.sort(reverse=True)

ans = 1
cnta = 0
cntb = 0
mod = 1000000007
for num in range(n*m,0,-1):
    if num in a and num in b:
        cnta += 1
        cntb += 1
        cnta%=mod
        cntb%=mod
    elif num in a and num not in b:
        ans *= cntb
        ans %= mod
        cnta += 1
    elif num not in a and num in b:
        ans *= cnta
        ans %= mod
        cntb += 1
    else:
        ans *= (cnta*cntb - (n*m - num))%mod
        ans %= mod

print(ans)

### FIXED CODE ###

n,m = map(int,input().split())
a = list(map(int,input().split()))
b = list(map(int,input().split()))
A=set(a);B=set(b)
ans = 1
cnta = 0
cntb = 0
mod = 10**9+7
for num in range(n*m,0,-1):
    if num in A and num in B:
        cnta += 1
        cntb += 1
    elif num in A:
        ans *= cntb
        cnta += 1
    elif num in B:
        ans *= cnta
        cntb += 1
    else:
        ans *= (cnta*cntb - (n*m - num))%mod
    ans %= mod
print(ans)
### BUGGY CODE ###

N = int(input())
L_A = [int(s) for s in input().rstrip().split(' ')]
k = 1
for i in range(N):
    if L_A[i] == 0:
        print(0)
        break
    else:
        k *= L_A[i]
else:
    if k > 10**18:
        print("-1")
    else:
        print(k)

### FIXED CODE ###

N = int(input())
L_A = [int(s) for s in input().rstrip().split(' ')]
if 0 in L_A:
    print(0)
else:
    k = 1
    for i in range(N):
        k *= L_A[i]
        if k > 10**18:
            print("-1")
            break
    else:
        print(k)
### BUGGY CODE ###

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

total = 0
for i in range(len(a)):
    for j in range(i+1, len(a)):
        total += (a[i]*a[j])
print(total% (10**9 + 7))


### FIXED CODE ###

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

mod_value = 10**9 + 7

sum = 0
total = 0
for i in reversed(range(1, len(a))):
    sum += a[i]
    total += a[i-1] * sum

print(total%mod_value)
### BUGGY CODE ###

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

for i in range(N):
    if i % 2 == 0:
        ret.append(A[i])
    else:
        ret.insert(0, A[i])

if N % 2 == 1:
    ret.reverse()

print(*ret)


### FIXED CODE ###

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

for i in range(N):
    if i % 2 == 0:
        ret.append(A[i])
ret.reverse()
for i in range(N):
    if i % 2 == 1:
        ret.append(A[i])

if N % 2 == 0:
    ret.reverse()

print(*ret)
### BUGGY CODE ###

from collections import deque

mod = 1000000007

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

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

plus_1 = deque()
minus_1 = deque()
plus_2 = deque()
minus_2 = deque()

a.sort()

for i in a:
    if i > 0:
        plus_2.append(i)
    else:
        minus_1.append(i)

a.sort(reverse=True)

for i in a:
    if i > 0:
        plus_1.append(i)
    else:
        minus_2.append(i)

maxa = 1

mini = 1

i = 0

while i < k:
    if len(plus_1) > 1 and len(minus_1) > 1:
        if plus_1[0]*plus_1[1] < minus_1[0]*minus_1[1] and i+2<=k:
            maxa *= minus_1[0]*minus_1[1]
            minus_1.popleft()
            minus_1.popleft()
            i += 2
        else:
            maxa *= plus_1[0]
            plus_1.popleft()
            i += 1
    elif len(plus_1):
        maxa *= plus_1[0]
        plus_1.popleft()
        i += 1
    else:
        maxa *= minus_1[0]
        minus_1.popleft()
        i += 1
if maxa > 0:
    print(maxa%mod)
    exit()

i = 0

while i < k:
    if len(plus_2) and len(minus_2):
        if plus_2[0] < abs(minus_2[0]):
            mini *= plus_2[0]
            plus_2.popleft()
        else:
            mini *= minus_2[0]
            minus_2.popleft()
    elif len(plus_2):
        mini *= plus_2[0]
        plus_2.popleft()
    else:
        mini *= minus_2[0]
        minus_2.popleft()
    i += 1

print(mini%mod)


### FIXED CODE ###

MOD = 10 ** 9 + 7
 
N, K = map(int, input().split())
l = list(map(int, input().split()))
pos = []
neg = []
z = 0
 
for v in l:
    if v > 0:
        pos.append(v)
    elif v < 0:
        neg.append(v)
    else:
        z += 1
pos.sort()
neg.sort()
 
if N - z < K:
    print(0)
elif N - z == K:
    if len(neg) % 2 and z:
        print(0)
    else:
        out = 1
        for v in neg + pos:
            out *= v
            out %= 10 ** 9 + 7
        print(out)
elif len(pos) == 0:
    if K % 2:
        if z:
            print(0)
        else:
            neg.reverse()
            out = 1
            for i in range(K):
                out *= neg[i]
                out %= 10 ** 9 + 7
            print(out)
    else:
        out = 1
        for i in range(K):
            out *= neg[i]
            out %= 10 ** 9 + 7
        print(out)
else:
    out = 1
    neg.reverse()
    if K % 2:
        out = pos.pop()
        K -= 1
    while K:
        if len(pos) >= 2:
            nP = pos[-1] * pos[-2]
        else:
            nP = 0
 
        if len(neg) >= 2:
            nN = neg[-1] * neg[-2]
        else:
            nN = 0
 
        if nP > nN:
            pos.pop()
            pos.pop()
            out *= nP
        else:
            neg.pop()
            neg.pop()
            out *= nN
        out %= MOD
        K -= 2
    print(out)
### BUGGY CODE ###

import sys

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def int_to_bits(x):
    return [ 1 if 2**i & x != 0 else 0 for i in range(60) ]

def inv(x, MOD):
    return pow(x, MOD-2, MOD)

MOD = 10**9+7

debug = False

if debug:
    n = 50000
    A = list(range(n))
else:
    n,*A = get_all_int()




# ビットごとの出現回数 2**i
bits = [0] * 60

for a in A:
    for i in range(60):
        if 2**i & a != 0:
            bits[i] += 1

# log("bits:", bits)

ans = 0

for a in A:
    a_bits = [ 1 if 2**i & a != 0 else 0 for i in range(60) ]

    for i in range(60):
        ans += 2**i * abs(bits[i] - (1 if 2**i & a != 0 else 0) *n)

    # a_dash = list(map(lambda a: a*(n-1), a_bits))

    # log("a_dash", a_dash)

    # bits_dash = [ bits[i] - a_bits[i] for i in range(60)]
    # log("bits_dash", bits_dash)
    # ans += sum( ( 2**i * abs(bits_dash[i]-2*a_dash[i])) for i in range(60) )

    # ans += sum( ( 2**i * abs(bits[i]-2*a_dash[i])) for i in range(60) )

    # for i in range(60):
    #     ans = (ans + 2**i * abs(bits_dash[i] - a_dash[i])) % MOD
    # log(a, ans)

print(ans//2 % MOD)


### FIXED CODE ###

import sys
import time

# 改行またはスペース区切りの入力をすべて読み込んでイテレータを返します。
def get_all_int():
    return map(int, open(0).read().split())

def log(*args):
    print("DEBUG:", *args, file=sys.stderr)

def int_to_bits(x):
    return [ 1 if 2**i & x != 0 else 0 for i in range(60) ]

def inv(x, MOD):
    return pow(x, MOD-2, MOD)

start = time.time()

MOD = 10**9+7

debug = False

if debug:
    n = 30 * 10000
    A = list(range(n))
else:
    n,*A = get_all_int()

# ビットごとの出現回数 2**i
bits = [0] * 60

for a in A:
    for i in range(60):
        if 2**i & a != 0:
            bits[i] += 1

# log("bits:", bits)
# log("bits.", time.time() - start)

# ans = 0

ans = sum(( pow(2, i, MOD) * bits[i] * (n-bits[i]) for i in range(60))) % MOD

# for a in A:
#     # a_bits = [ 1 if 2**i & a != 0 else 0 for i in range(60) ]

#     for i in range(60):
#         ans += 2**i * abs(bits[i] - (1 if 2**i & a != 0 else 0) *n)

#     # a_dash = list(map(lambda a: a*(n-1), a_bits))

#     # log("a_dash", a_dash)

#     # bits_dash = [ bits[i] - a_bits[i] for i in range(60)]
#     # log("bits_dash", bits_dash)
#     # ans += sum( ( 2**i * abs(bits_dash[i]-2*a_dash[i])) for i in range(60) )

#     # ans += sum( ( 2**i * abs(bits[i]-2*a_dash[i])) for i in range(60) )

#     # for i in range(60):
#     #     ans = (ans + 2**i * abs(bits_dash[i] - a_dash[i])) % MOD
#     # log(a, ans)

# print(ans//2 % MOD)
print(ans)
# log("end.", time.time() - start)
### BUGGY CODE ###

R,G,B,N = map(int, input().split())

ans = 0
for r in range((N//R)+1):
  for g in range((N//G)+1):
    if (N-R*r-G*g) >= 0 and (N-R*r-G*g) % B == 0:
      ans += 1
print(ans)

### FIXED CODE ###

R,G,B,N = map(int, input().split())

ans = 0
for r in range((N//R)+1):
  for g in range((N//G)+1):
    if (N-R*r-G*g) >= 0 and (N-R*r-G*g) % B == 0:
      ans += 1
print(ans)
### BUGGY CODE ###

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

def f(A):
  D=[0]*(N+1)
  for j in range(N):
    d=A[j]
    mi=max(j-A[j],0)
    ma=min(j+A[j],N-1)
    D[mi]+=1
    D[ma+1]-=1   
  for j in range(1,N):
    D[j]+=D[j-1]
  A=D
  return A 

for i in range(K):
  D=f(A)
  A=D
  if A[:-1]==[N]*(N):
    break
print(*A[:-1])

### FIXED CODE ###

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

def f(A):
  D=[0]*(N+1)
  for j in range(N):
    mi=max(j-A[j],0)
    ma=min(j+A[j],N-1)
    D[mi]+=1
    D[ma+1]-=1   
  for i in range(1,N):
    D[i]+=D[i-1]
  A=D[:-1]
  return A 

for i in range(min(K,42)):
  A=f(A)
print(*A)
### BUGGY CODE ###

H,W = map(int,input().split())
HW = [[st for st in input()] for _ in range(H)]
inf = float('inf')
memo = [[inf]*W for _ in range(H)]

def bfs(HW,memo):
    black = []
    for ii in range(H):
        for jj in range(W):
            if HW[ii][jj] == "#":
                black.append((ii,jj))
                memo[ii][jj] = 0
    ans = 0
    while len(black) > 0:
            next = black.pop(0)
            i,j = next
            if 0 <= i - 1:
                if HW[i-1][j] == ".":
                    black.append((i-1,j))
                    HW[i-1][j] = "#"
                    memo[i-1][j] = min(memo[i-1][j],memo[i][j] + 1)
                    if memo[i-1][j] > ans:
                        ans = memo[i-1][j]
            if 0 <= i + 1 < H:
                if HW[i+1][j] == ".":
                    black.append((i+1,j))
                    HW[i+1][j] = "#"
                    memo[i+1][j] = min(memo[i+1][j],memo[i][j] + 1)
                    if memo[i+1][j] > ans:
                        ans = memo[i+1][j]
            if 0 <= j - 1:
                if HW[i][j-1] == ".":
                    black.append((i,j-1))
                    HW[i][j-1] = "#"
                    memo[i][j-1] = min(memo[i][j-1],memo[i][j] + 1)
                    if memo[i][j-1] > ans:
                        ans = memo[i][j-1]
            if j + 1 < W:
                if HW[i][j+1] == ".":
                    black.append((i,j+1))
                    HW[i][j+1] = "#"
                    memo[i][j+1] = min(memo[i][j+1],memo[i][j] + 1)
                    if memo[i][j+1] > ans:
                        ans = memo[i][j+1]
    return ans
print(bfs(HW,memo))






### FIXED CODE ###

h, w = map(int, input().split())
A = [["#"]*(w+2)] + [["#"] + [s for s in input()] + ["#"]
                     for _ in range(h)] + [["#"]*(w+2)]


def main():
    step = 0
    Q = set([])
    for hh in range(1, h + 1):
        for ww in range(1, w + 1):
            if A[hh][ww] == "#":
                if A[hh - 1][ww] == ".":
                    Q.add((hh - 1, ww))
                if A[hh][ww - 1] == ".":
                    Q.add((hh, ww - 1))
                if A[hh + 1][ww] == ".":
                    Q.add((hh + 1, ww))
                if A[hh][ww + 1] == ".":
                    Q.add((hh, ww + 1))
    while len(Q) > 0:
        step += 1
        new = set([])
        for hh, ww in Q:
            A[hh][ww] = "#"
        while len(Q) > 0:
            hh, ww = Q.pop()
            if A[hh - 1][ww] == ".":
                A[hh-1][ww] = "#"
                new.add((hh - 1, ww))
            if A[hh][ww - 1] == ".":
                A[hh][ww-1] = "#"
                new.add((hh, ww - 1))
            if A[hh + 1][ww] == ".":
                A[hh+1][ww] = "#"
                new.add((hh + 1, ww))
            if A[hh][ww + 1] == ".":
                A[hh][ww + 1] = "#"
                new.add((hh, ww + 1))
        Q = new.copy()
    print(step)
    return


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

from collections import deque

n,x,y=map(int,input().split())
x,y=x-1,y-1
e = [[2*10**3+1]*n for _ in range(n)]
for i in range(n):
    e[i][i] = 0

def main():
    for i in range(n):
        s = deque([i])  # サーチstack. 初期条件を設定
        dfs(s, e[i])
    #print(e)
    ans = [0]*n
    for i,ee in enumerate(e):
        for eee in ee[i:]:
            ans[eee] += 1
    for i in ans[1:]:
        print(i)

def dfs(s,e):
    while len(s) > 0:  # len(s) > 0 でループ
        t = s.popleft()
        for i in get_children(t):  # t の子ノードを列挙
            if e[i] != 2*10**3+1 and e[i] < e[t]+1:
                continue
            s.append(i)
            e[i] = min(e[i], e[t] + 1) # 探索済としつつ距離を入れる

def get_children(t):
    if t in (x,y):
        yield y if t == x else x
    if 0 < t:
        yield t-1
    if t < (n-1):
        yield t+1

if __name__ == "__main__":
    main()

### FIXED CODE ###

from collections import Counter
def main():
    n,x,y=map(int,input().split())
    x,y=x-1,y-1
    ans=[]
    for i in range(n):
        dp = [n]*n
        dp[i] = 0
        calcstep(i, dp)
        dp[y] = min(dp[y], dp[x]+1)
        dp[x] = min(dp[x], dp[y]+1)
        calcstep(x, dp)
        calcstep(y, dp)
        #print(i, dp)
        ans += dp
    ans = Counter(ans)
    for i in range(1,n):
        print(ans[i]//2)

def calcstep(i, dp):
    for j in range(i, len(dp)-1):
        if dp[j+1] > dp[j]+1:
            dp[j+1] = dp[j]+1
        else:
            break
    for j in range(1,i+1)[::-1]:
        if dp[j-1] > dp[j]+1:
            dp[j-1] = dp[j]+1
        else:
            break

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

import sys
input = sys.stdin.readline
import numpy as np

N, K = [int(item) for item in input().split()]
h =np.array([int(item) for item in input().split()])

dp = np.array([10**10+1 for _ in range(N+1)])
dp[0] = 0

for i in range(1, N):
    start = max(0, i-K)
    cost = np.abs(h[start:i] - h[i])
    dp[i] = min(dp[start:i] + cost)

    # print(dp)
print(dp[N-1])

### FIXED CODE ###

import numpy as np

N, K = [int(item) for item in input().split()]
h =np.array([int(item) for item in input().split()])
# print(h.shape)
dp = np.full(N+K, 10**10+1, dtype='int64')
dp[0] = 0

for i in range(1, N):
    max1 = min(N, i+K)
    cost = abs(h[i:max1] - h[i-1])
    # print(cost.shape, dp[i:max1].shape)
    dp[i:max1] = np.minimum(dp[i:max1], dp[i-1] + cost)

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

N,K = map(int,input().split())
H = list(map(int,input().split()))
inf = float('inf')
H += [inf for _ in range(K+5)]
dp = [inf]*(N+K+5)
dp[0] = 0
dp[1] = abs(H[0]-H[1])
#dp[2] = abs(H[1]-H[0])
# for i in range(2,N):
#     dp[i] = min(dp[i-1]+abs(H[i-1]-H[i]), dp[i-2]+abs(H[i-2]-H[i]))
# print(dp[N-1])

for i in range(N):
    for j in range(K+1):
        dp[i+j] = min(dp[i+j],dp[i]+abs(H[i]-H[i+j])) # 配るdp,Hの配列外参照が微妙
print(dp[N-1])


### FIXED CODE ###

N,K = map(int,input().split())
H = list(map(int,input().split()))
inf = float('inf')
H += [inf for _ in range(K+5)]
dp = [inf]*(N+K+5)
dp[0] = 0
dp[1] = abs(H[0]-H[1])
#dp[2] = abs(H[1]-H[0])
# for i in range(2,N):
#     dp[i] = min(dp[i-1]+abs(H[i-1]-H[i]), dp[i-2]+abs(H[i-2]-H[i]))
# print(dp[N-1])

for i in range(N):
    for j in range(K+1):
        dp[i+j] = min(dp[i+j],dp[i]+abs(H[i]-H[i+j])) # 配るdp,Hの配列外参照が微妙
print(dp[N-1])
### BUGGY CODE ###

from heapq import heappush, heappop


def solve(string):
    n, m, *a = map(int, string.split())
    while m > 0:
        a.sort(reverse=True)
        b = a[0] // 2
        for i, _a in enumerate(a):
            if m == 0 or _a <= b:
                break
            a[i] //= 2
            m -= 1
    return str(sum(a))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


### FIXED CODE ###

from heapq import heappush, heappop


def solve(string):
    n, m, *a = map(int, string.split())
    h = []
    for _a in a:
        heappush(h, -_a)
    for _ in range(m):
        heappush(h, -(-heappop(h) // 2))
    return str(-sum(h))


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
### BUGGY CODE ###

N, M = map(int, input().split())
C = [tuple(map(int, input().split())) for _ in range(M)]
P = {c[0]: [] for c in C}
for c in C:
    P[c[0]].append(c[1])
for p in P:
    P[p].sort()
for c in C:
    print('{:06}{:06}'.format(c[0], 1 + P[c[0]].index(c[1])))


### FIXED CODE ###

N, M = map(int, input().split())
C = [tuple(map(int, input().split())) for _ in range(M)]
P = {c[0]: [] for c in C}
for c in C:
    P[c[0]].append(c[1])
for p in P:
    P[p].sort()
    P[p] = {P[p][i]: i + 1 for i in range(len(P[p]))}
for c in C:
    print('{:06}{:06}'.format(c[0], P[c[0]][c[1]]))
### BUGGY CODE ###


# -*- coding: utf-8 -*-
import sys

input = sys.stdin.readline


def read_int():
    return int(input())

def slv():
    N, M, L = list(map(int, input().split()))
    g = [[sys.maxsize]*(N) for _ in range(N)]
    for i in range(N):
        g[i][i] = 0
    for _ in range(M):
        a, b, c = list(map(int, input().split()))
        if c <= L:
            g[a-1][b-1] = c
            g[b-1][a-1] = c
    
    for k in range(N):
        for i in range(N):
            for j in range(N):
                g[i][j] = min(g[i][j], g[i][k] + g[k][j])
    gg = [[sys.maxsize]*(N) for _ in range(N)]
    for u in range(N):
        for v in range(N):
            if g[u][v] <= L:
                gg[u][v] = 1
    
    for k in range(N):
        for i in range(N):
            for j in range(N):
                gg[i][j] = min(gg[i][j], gg[i][k] + gg[k][j])

    Q = read_int()
    for _ in range(Q):
        s, t = list(map(int, input().split()))
        c = gg[s-1][t-1]
        if c != sys.maxsize:
            print(c-1)
        else:
            print(-1)



def main():
    slv()
    # N, M, L = read_int_n()
    # ABC = [read_int_n() for _ in range(M)]
    # Q = read_int()
    # ST = [read_int_n() for _ in range(Q)]
    
    # (slv(N, M, L, ABC, Q, ST))


if __name__ == '__main__':
    main()


### FIXED CODE ###

def slove():
    import sys
    input = sys.stdin.readline
    n, m, l = list(map(int, input().rstrip('\n').split()))
    INF = 10 ** 11
    w = [[INF] * n for _ in range(n)]
    wl = [[INF] * n for _ in range(n)]

    for i in range(n):
        w[i][i] = 0

    for i in range(m):
        a, b, c = list(map(int, input().rstrip('\n').split()))
        if c <= l:
            w[a - 1][b - 1] = c
            w[b - 1][a - 1] = c

    for i in range(n):
        for j in range(n):
            for k in range(n):
                w[j][k] = min(w[j][k], w[j][i] + w[i][k])

    for i in range(n):
        for j in range(n):
            if w[i][j] <= l:
                wl[i][j] = 1
    for i in range(n):
        for j in range(n):
            for k in range(n):
                wl[j][k] = min(wl[j][k], wl[j][i] + wl[i][k])

    q = int(input().rstrip('\n'))
    for i in range(q):
        s, t = list(map(int, input().rstrip('\n').split()))
        if wl[s-1][t-1] == INF:
            print(-1)
        else:
            print(wl[s-1][t-1] - 1)


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

N = int(input())
l = [int(i) for i in input().split()]
count = 0
l_new = sorted(l,reverse=True)
for i in range(N-2):
    for j in range(i+1,N-1):
        for c in range(j+1,N):
            if l_new[i] >= l_new[j] + l_new[c]:
                break
            else:
                count += 1
print(count)

### FIXED CODE ###

import bisect
N = int(input())
l = [int(i) for i in input().split()]
count = 0
l_new = sorted(l)
for i,a in enumerate(l_new):
    for j,b in enumerate(l_new[i+1:],start = i+1):
        left = bisect.bisect_right(l_new,abs(a-b))
        right = bisect.bisect_left(l_new,a + b)
        count += right - left
        
        if left <= i < right:
            count -= 1
        if left <= j < right:
            count -= 1
        
print(count//3)
### BUGGY CODE ###

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))


#loop
c = 0
loc = 0
locs = [0]
ini = 0
while True:
    c += 1
    loc = a[loc] - 1
    
    if c == k:
        print(loc + 1)
        break
    if loc in locs:
        ini = locs.index(loc)
        break
    locs.append(loc)

if c != k:
    rest = (k - ini) % (c - ini)
    if rest == 0:
        print(locs[ini] + 1)
    else:
        d = 0
        while True:
            d += 1
            loc = a[loc] - 1
            if d == rest:
                print(loc + 1)
                break

### FIXED CODE ###

n, k = list(map(int, input().split()))
a = list(map(int, input().split()))

c = 0
loc = 0
locs = {0: 0}
ini = 0

while True:
    c += 1
    loc = a[loc] - 1
    
    if c == k:
        print(loc + 1)
        break
    if loc in locs:
        ini = locs.get(loc)
        break
    locs[loc] = c

if c != k:
    rest = int((k - ini) % (c - ini))
    if rest <= 0:
        print(loc + 1)
    else:
        d = 0
        while True:
            d += 1
            loc = a[loc] - 1
            if d == rest:
                print(loc + 1)
                break
### BUGGY CODE ###

n = int(input())
As = list(map(int, input().split()))
As.sort()
table = [0] * (10 ** 6 + 1)
ans = n
for a in As:
    tmp = a
    table[tmp] += 1
    for _ in range((10 ** 6) // a - 1):
        tmp += a
        table[tmp] += 1
for a in As:
    ans -= (table[a] > 1)
print(ans)


### FIXED CODE ###

import numpy as np
import sys
def input(): return sys.stdin.readline().strip()

n = int(input())
As = list(map(int, input().split()))
ans = n
val = 10 ** 6
table = np.array([0] * (val + 1))
for a in As:
    if table[a] > 1:
        continue
    table[::a] += 1
for a in As:
    ans -= (table[a] > 1)
print(ans)
### BUGGY CODE ###

import os

def main():
        n = int(input())
        a_list = list(map(int, input().split()))
        result = [a_list.count(i) for i in range(1,n+1)]
        for i in result:
                print(i)

if __name__ == "__main__":
        main()

### FIXED CODE ###

import os

def main():
	n = int(input())
	a_list = list(map(int, input().split()))
	result = [0]*n
	for i in a_list:
		result[i-1] += 1
	for i in result:
		print(i)

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

sx, sy, tx, ty = map(int, input().split())
gp = []


def fn(q, gx, gy):
    while len(q) > 0:
        x, y, d, p = q.pop(0)
        for xx, yy, dd in [(x + 1, y, 'R'), (x - 1, y, 'L'), (x, y + 1, 'U'), (x, y - 1, 'D')]:
            if (xx, yy) == (gx, gy):
                gp.extend(p + [(xx, yy)])
                return d + dd
            if -1000 <= xx <= 1000 and -1000 <= yy <= 1000 and (xx, yy) not in p:
                q.append((xx, yy, d + dd, p + [(xx, yy)]))


print(fn([(sx, sy, '', gp)], tx, ty) + fn([(tx, ty, '', gp)], sx, sy) +
      fn([(sx, sy, '', gp)], tx, ty) + fn([(tx, ty, '', gp)], sx, sy))


### FIXED CODE ###

sx, sy, tx, ty = map(int, input().split())

ans = ''
ans += 'R' * (tx - sx)
ans += 'U' * (ty - sy)
ans += 'L' * (tx - sx)
ans += 'D' * (ty - sy)
ans += 'D' + 'R' * (tx - sx + 1)
ans += 'U' * (ty - sy + 1) + 'L'
ans += 'U' + 'L' * (tx - sx + 1)
ans += 'D' * (ty - sy + 1) + 'R'

print(ans)