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

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

for n in numbers:
    if n not in paper:
        paper.append(n)
    else:
        paper.remove(n)

print(len(paper))

### FIXED CODE ###

from collections import Counter
N = int(input())
numbers = [int(input()) for i in range(N)]

num_cnt = Counter(numbers)

ans_box = list(filter(lambda x:x%2==1 , num_cnt.values()))
print(len(ans_box))
### BUGGY CODE ###

def com(n,m):
    if(n-m < m):
        m=n-m
    result=1
    mylist=[i for i in range(1,m+1)]
    j=1
    for i in range(1,m+1):
        result*=(n+1-i)
        if(j<m):
            while(result%mylist[j]==0):
                result//=mylist[j]
                j+=1
                if(j>=m):
                    break
    return result

N,M=map(int,input().split())
soinsuubunkai=[]
tmp=1
i=2
flag=0
while(i <=M):
    if(M%i==0):
        if(flag==0):
            soinsuubunkai.append(1)
        else:
            soinsuubunkai[-1]+=1
        M//=i
        flag=1
    else:
        i+=1
        flag=0

tmp=1
for k in soinsuubunkai:
    tmp*=com(k+N-1,k)
    tmp%=10**9+7
print(tmp)

### FIXED CODE ###

def com(n,m):
    if(n-m < m):
        m=n-m
    result=1
    mylist=[i for i in range(1,m+1)]
    j=1
    for i in range(1,m+1):
        result*=(n+1-i)
        if(j<m):
            while(result%mylist[j]==0):
                result//=mylist[j]
                j+=1
                if(j>=m):
                    break
    return result

def yakusuu(i,m):
    _i=i
    while(i**2<=m):
        if(m%i==0):
            return i
        else:
            i+=1
    for j in range(_i-1,0,-1):
        if(m%j==0):
            break
    return m//j
    

N,M=map(int,input().split())
soinsuubunkai={}
tmp=2
i=2
_M=M
while(tmp <=M):
    tmp=yakusuu(tmp,M)

    if(tmp in soinsuubunkai):
        soinsuubunkai[tmp]+=1
    else:
        soinsuubunkai[tmp]=1
    M//=tmp
    if(M==1):
        break


tmp=1
for k in list(soinsuubunkai.values()):
    tmp*=com(k+N-1,k)
    tmp%=10**9+7
print(tmp)
### BUGGY CODE ###

MOD = 10**9 + 7
memo = dict()


def gcd(a, b):
    if (a, b) in memo:
        return memo[(a, b)]

    while b != 0:
        a, b = b, a - (a // b) * b

    memo[(a, b)] = a
    memo[(b, a)] = a

    return a


def lcm(iterable):
    a = iterable[0]

    for b in iterable:
        a = a * b // gcd(a, b)

    return a


def main():
    N = int(input())
    an = list(map(int, input().split()))

    lcm_an = lcm(an)

    ans = 0
    for a in an:
        ans += lcm_an // a
        ans %= MOD

    print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import functools

MOD = 10**9 + 7


def lcm(a, b) -> int:
    c, d = a, b
    while d != 0:
        c, d = d, c % d
    return a // c * b


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


def pow(x: int, n: int) -> int:
    res = 1
    while n > 0:
        if n & 1 == 1:
            res = res * x % MOD
        x = x * x % MOD
        n >>= 1

    return res


def main():
    N = int(input())
    an = list(map(int, input().split()))

    lcm_an = functools.reduce(lcm, an)
    lcm_an %= MOD

    ans = 0
    for a in an:
        ans = (ans + lcm_an * inv_mod(a)) % MOD

    print(ans)


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

import sys
mod = 10 ** 9 + 7

n,m = map(int,input().split())
if n in [0,1]:
    print(1)
    sys.exit()
    
if not m == 0:
    lis = [int(input()) for x in range(m)]
else:
    lis = []
val1 = 1
if 1 in lis:
    val2 = 0
else:
    val2 = 1
#print(stairs)
f = 0
for x in range(2,n):
    if x in lis:
        now = 0
    else:
        now = (val1 + val2) % mod
    val1,val2 = val2,now
    
#print(stairs)
print((val1 + val2) % mod)
    


### FIXED CODE ###

import sys
mod = 10 ** 9 + 7

n,m = map(int,input().split())
if n in [0,1]:
    print(1)
    sys.exit()
    
if not m == 0: lis = [int(input()) for x in range(m)]
else: lis = [-1]
val1 = 1
if 1 in lis: val2 = 0
else: val2 = 1

if lis[0] == 1 and len(lis) >= 2:
    flg = lis[1]
    nex = 1
else:
    flg = lis[0]
    nex = 0
#print(lis)
for x in range(2,n):
    if x == flg: #x in lis
        #print(flg)
        nex += 1
        try: flg = lis[nex]
        except:flg = 0
        now = 0
    else:
        now = (val1 + val2) % mod
    val1,val2 = val2,now
    
print((val1 + val2) % mod)
### BUGGY CODE ###

k,s= list(map(int, input().split()))
count=0
for x in range(k+1):
    for y in range(k+1):
        for z in range(k+1):
            if x+y+z==s:
                count+=1
print(count)

### FIXED CODE ###

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

import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

def main():
    N, M = mi()
    A = sorted(li())

    for j in range(M):
        b, c = mi()
        ind = min(bisect.bisect_left(A, c), b)
        A = sorted([c]*ind + A[ind:])
    
    print(sum(A))


if __name__ == "__main__":
    main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10**8)
def ii(): return int(sys.stdin.readline())
def mi(): return map(int, sys.stdin.readline().split())
def li(): return list(map(int, sys.stdin.readline().split()))
def li2(N): return [list(map(int, sys.stdin.readline().split())) for _ in range(N)]
def dp2(ini, i, j): return [[ini]*i for _ in range(j)]
def dp3(ini, i, j, k): return [[[ini]*i for _ in range(j)] for _ in range(k)]
import bisect #bisect.bisect_left(B, a)
#from collections import defaultdict #d = defaultdict(int) d[key] += value

def main():
    N, M = mi()
    A = sorted(li())

    '''
    for j in range(M):
        b, c = mi()
        ind = min(bisect.bisect_left(A, c), b)
        A = sorted([c]*ind + A[ind:])
    
    print(sum(A))
    '''
    ab = li2(M)
    ab.sort(key=lambda x: x[1], reverse=True)
    c_list = []
    l = 0
    for b, c in ab:
        if l + b > N:
            c_list += [c]*(N-l)
            l = N
        else:
            c_list += [c]*b
            l += b
        if l == N:
            break
    ans = sum(sorted(A+c_list, reverse=True)[:N])
    print(ans)

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

from itertools import product
def main():
    d, g = map(int, input().split())
    score_set = []
    score_pat = []
    for i1 in range(1, d + 1):
        kazu, bonus = map(int, input().split())
        score = [i1, kazu, bonus]
        score_set.append(score)
        score_pat.append(range(kazu + 1))
    score_get_pat = tuple(product(*score_pat))
    inf = float('inf')
    r = inf
    for scpe in score_get_pat:
        score_e  = 0
        for j1 in range(d):
            score_e += scpe[j1] * score_set[j1][0] * 100
            if scpe[j1] == score_set[j1][1]:
                score_e += score_set[j1][2]
        if score_e >= g:
            r = min(r, sum(scpe))
    print(r)


if __name__ == '__main__':
    main()


### FIXED CODE ###

from itertools import product
from math import ceil
def main():
    d, g = map(int, input().split())
    scoremax_set = []
    numq_set = []
    for i1 in range(1, d + 1):
        kazu, bonus = map(int, input().split())
        scoremax_set.append(i1 * 100 * kazu + bonus)
        numq_set.append(kazu)
    score_get_pat = tuple(product((1,0), repeat=d))

    inf = float('inf')
    r = inf

    for sgpe in score_get_pat:
        score = 0
        q_num = 0
        for j1, s in zip(sgpe, scoremax_set):
            score += j1 * s
        for j2, num in zip(sgpe, numq_set):
            q_num += j2 * num
        if score >= g:
            r = min(r, q_num)
        else:
            sgpe_l = [i for i, x in enumerate(sgpe) if x == 0]
            score_plus = (sgpe_l[-1]+1)*100 * (numq_set[sgpe_l[-1]] - 1)
            if score + score_plus >= g:
                q_num += ceil((g - score) / ((sgpe_l[-1]+1)*100))
                r = min(r, q_num)
    print(r)


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

N = int(input())
A_array = list(map(int, input().split()))
ans = 0

for i in range(N):
    Ai = A_array[i]
    for j, Aj in enumerate(A_array):
        if j == i:
          if j == N-1:
            ans += 1
          else:
            continue
        else:
            if Ai % Aj == 0:
              break
            elif j == N - 1:
              ans += 1
print(ans)

### FIXED CODE ###

N = int(input())
A = list(map(int, input().split()))
A.sort()                  #エラトステネスの篩にかけるためソート
Amax = A[-1]
dp = [1]*(Amax+1)         #Aの最大値までのエラトステネスの篩を作る。
ans = 0
for i in range(len(A)-1):
  p = A[i]
  if dp[p] == 1:          #A[i]がA[j]の倍数でないかをエラトステネスの篩でチェック
    for q in range(Amax//p+1):
      dp[p*q] = 0         #A[i]の倍数をすべて0にする
    if A[i] != A[i+1]: 
      ans += 1            #A[i]が重複していなければカウント
if dp[Amax] == 1:         #重複チェック時にレンジオーバーするためAmaxだけ別で判定 
  ans += 1
print(ans)
### BUGGY CODE ###

N = int(input())
A = list(map(int, (input() for i in range(N))))

for i in range(N) :
  x = A[i]
  A.remove(x)
  print(max(A))
  A.insert(i,x)

### FIXED CODE ###

N = int(input())
A = list(map(int, (input() for i in range(N))))
B = sorted(A, reverse=True)
a = B[0]
a1 = B[1]


for x in A:  
  if x != a:
    print(a)
  else:
    print(a1)
### BUGGY CODE ###

import sys
input=sys.stdin.readline
N,M=map(int,input().split())

a,b=map(int,input().split())
A=[a]
B=[b]

l=[1 for i in range(N+1)]

L=[[]for i in range(N+1)]

for i in range(M-1):
    x,y=map(int,input().split())
    L[x].append(y)
    L[y].append(x)
    
l[a]=0
l[b]=0


P=a
for i in range(10**5):
    for j in L[P]:
        if l[j]!=0:
            P=j
            l[j]=0
            A.append(j)
            break
    if len(L[P])==0:
        break
    elif max(L[P])==0:
        break
P=b
for i in range(10**5):
    for j in L[P]:
        
        if l[j]!=0:
            P=j
            l[j]=0
            B.append(j)
            break
    if len(L[P])==0:
        break
    elif max(L[P])==0:
        break


print(len(A)+len(B))

ANS=str(A[len(A)-1])
for i in range(1,len(A)):
    ANS+=" "+str(A[len(A)-1-i])
for i in range(len(B)):
    ANS+=" "+str(B[i])
print(ANS)
        
    

### FIXED CODE ###

import sys
input=sys.stdin.readline

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

R=[1 for i in range(N+1)]
A,B=map(int,input().split())
R[A]=0
R[B]=0

L=[[]for i in range(N+1)]
L[A].append(B)
L[B].append(A)

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

l=[A]
P=A
#print(L)

for i in range(10**6):
    flag=0
    #print("P",L[P])
    for j in L[P]:
        #print("j",L,L[P],j,P)
        if R[j]==1:
            P=j
            R[j]=0
            l.append(j)
            flag+=1
            break
    if flag==0:
        break
#print(l)
r=[B]
P=B
for i in range(10**6):
    flag=0
    #print("P",L[P])
    for j in L[P]:
        #print("j",L,L[P],j,P)
        if R[j]==1:
            P=j
            R[j]=0
            r.append(j)
            flag+=1
            break
    if flag==0:
        break
#print(r)
l=l[::-1]
ans=l+r

ANS=str(ans[0])
for i in range(1,len(ans)):
    ANS+=" "+str(ans[i])
print(len(ans))
print(ANS)
### BUGGY CODE ###

import sys
from collections import deque

H, W = map(int, sys.stdin.readline().split())
cy, cx = map(int, sys.stdin.readline().split())
gy, gx = map(int, sys.stdin.readline().split())

cy -= 1
cx -= 1
gy -= 1
gx -= 1

grid = []
for _ in range(H):
    grid.append(sys.stdin.readline().strip())

q = deque()
# x, y, 累積移動距離, ブロック通過数, ワープ利用数
q.append((cx, cy, 0, 0, 0))
visited_d = {}
visited_e = {}
ans = float("inf")
while q:
    x, y, c, d, e = q.popleft()
    if (x, y) in visited_e and visited_e[(x, y)] <= e:
        continue
    visited_e[(x, y)] = e
    # print(x, y, c, d, e)
    for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        nx = x + dx
        ny = y + dy
        if 0 <= nx < W and 0 <= ny < H and grid[ny][nx] != "#":
            if nx == gx and ny == gy:
                ans = min(ans, e)
                continue
            q.appendleft((nx, ny, c+1, d, e))
    for dx in range(-2, 3):
        for dy in range(-2, 3):
            if abs(dx) == 1 and dy == 0 or abs(dy) == 1 and dx == 0:
                continue
            nx = x + dx
            ny = y + dy
            # print("warp", dx, dy)
            if 0 <= nx < W and 0 <= ny < H and grid[ny][nx] != "#":
                if nx == gx and ny == gy:
                    ans = min(ans, e+1)
                    continue
                # print("warp append")
                q.appendleft((nx, ny, c+1, d, e+1))

print(-1 if ans == float("inf") else ans)

### FIXED CODE ###

import sys
from collections import deque

H, W = map(int, sys.stdin.readline().split())
cy, cx = map(int, sys.stdin.readline().split())
gy, gx = map(int, sys.stdin.readline().split())

cy -= 1
cx -= 1
gy -= 1
gx -= 1

grid = []
for _ in range(H):
    grid.append(sys.stdin.readline().strip())

q = deque()
# x, y, 累積移動距離, ブロック通過数, ワープ利用数
q.append((cx, cy, 0))
visited_d = {}
visited_e = {}
ans = float("inf")
while q:
    x, y, e = q.popleft()
    if (x, y) in visited_e and visited_e[(x, y)] <= e:
        continue
    visited_e[(x, y)] = e
    # print(x, y, c, d, e)
    for dx, dy in ((1, 0), (-1, 0), (0, 1), (0, -1)):
        nx = x + dx
        ny = y + dy
        if 0 <= nx < W and 0 <= ny < H and grid[ny][nx] != "#":
            if nx == gx and ny == gy:
                ans = min(ans, e)
                continue
            if (nx, ny) not in visited_e:
                q.appendleft((nx, ny, e))
    for dx in range(-2, 3):
        for dy in range(-2, 3):
            if abs(dx) == 1 and dy == 0 or abs(dy) == 1 and dx == 0:
                continue
            nx = x + dx
            ny = y + dy
            # print("warp", dx, dy)
            if 0 <= nx < W and 0 <= ny < H and grid[ny][nx] != "#":
                if nx == gx and ny == gy:
                    ans = min(ans, e+1)
                    continue
                # print("warp append")
                if (nx, ny) not in visited_e:
                    q.append((nx, ny, e+1))

print(-1 if ans == float("inf") else ans)
### BUGGY CODE ###

n, m = map(int,input().split())
    
aaa = 0
tbin_1 = []
tbin_n = []
for i in range(m):
    xxx = list(map(int,input().split()))
    if xxx[0] == 1:
        tbin_1.append(xxx[1])
    elif xxx[1] == n :
        tbin_n.append(xxx[0])
    else:
        None
    if xxx[0] == 1 and xxx[1] in tbin_n:
        aaa = 1
        break
    elif xxx[1] == n and xxx[0] in tbin_1:
        aaa = 1
        break


if aaa == 1 :
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')

### FIXED CODE ###

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

boolins =[]
for i in range(n):
    boolins.append(0)
    
for i in range(m):
    xxx = list(map(int,input().split()))
    if xxx[0] == 1:
        boolins[xxx[1]] = boolins[xxx[1]] + 1
    elif xxx[1] == n :
        boolins[xxx[0]]=boolins[xxx[0]]+ 1
    else:
        None


if 2 in boolins:
    print('POSSIBLE')
else:
    print('IMPOSSIBLE')
### BUGGY CODE ###

import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B,N = LMIIS()

    ans = 0
    for i in range(max(0,N-10**7),N+1):
        ans = max(floor(A*i/B)-A*floor(i/B),ans)
    for i in range(1,min(N+1,N-10**7)):
        ans = max(floor(A*i/B)-A*floor(i/B),ans)
    
    
    print(ans)


    

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys,os
from collections import defaultdict, deque
from math import ceil, floor
if sys.version_info[1] >= 5:
    from math import gcd
else:
    from fractions import gcd
sys.setrecursionlimit(10**6)
write = sys.stdout.write
dbg = (lambda *something: print(*something)) if 'TERM_PROGRAM' in os.environ else lambda *x: 0
def main(given=sys.stdin.readline):
    input = lambda: given().rstrip()
    LMIIS = lambda: list(map(int,input().split()))
    II = lambda: int(input())
    MOD = 10**9+7

    A,B,N = LMIIS()

    ans = 0
    if N >= B -1:
        print(floor(A*(B-1)/B)-A*floor((B-1)/B))
    else:
        print(floor(A*N/B)-A*floor(N/B))
    
    # for i in range(1,int(N**0.5)+1):
    #     ans = max(ans,floor(A*i/B)-A*floor(i/B))
    #     i2 = N//i
    #     ans = max(ans,floor(A*i2/B)-A*floor(i2/B))
    #     # print(i,i2)
    # print(ans)

    # ans2 = 0
    # for i in range(1,N+1):
    #     ans2 = max(ans2,floor(A*i/B)-A*floor(i/B))
    # print(ans2)
    

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

n,k=map(int,input().split())
a=list(map(int,input().split()))
l=[0]
for i in range(1,n):
  b=a[i]
  l.append(min(l[j]+abs(b-a[j])for j in range(max(0,i-k),i)))
print(l[-1])

### FIXED CODE ###

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

import itertools

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

answer = 0

nums=[]
for i in range(1, M+1):
    nums.append(i)

for balls in itertools.combinations_with_replacement(nums, N):
    score = 0
    for i in range(Q):
        test = sorted(list(balls))
        if test[abcd[i][0]-1] + abcd[i][2] == test[abcd[i][1]-1]:
            score += abcd[i][3]
    if score > answer:
        answer = score

print(answer)


### FIXED CODE ###

import itertools

N, M, Q = map(int, input().split())
abcd = [list(map(int, input().split())) for i in range(Q)]

answer = 0

nums=[]
for i in range(1, M+1):
    nums.append(i)

for balls in itertools.combinations_with_replacement(nums, N):
    score = 0
    test = list(balls)
    for i in range(Q):
        if test[abcd[i][0]-1] + abcd[i][2] == test[abcd[i][1]-1]:
            score += abcd[i][3]
    if score > answer:
        answer = score

print(answer)
### BUGGY CODE ###

n = int(input())
K = []
T = []
F = []
for _ in range(n):
  s = input()
  if "." not in s:
    s += "."
  a, b = s.split(".")
  k = len(b)
  c = int(a+b)
  t = 0
  while c%2 == 0:
    c //= 2
    t += 1
  T.append(t-k)
  f = 0
  while c%5 == 0:
    c //= 5
    f += 1
  F.append(f-k)
ans = 0
for i in range(n-1):
  t1, f1 = T[i], F[i]
  for j in range(i+1, n):
    t2, f2 = T[j], F[j]
    if 0 <= min(t1+t2, f1+f2):
      ans += 1
print(ans)

### FIXED CODE ###

class BIT():
 
    __slots__ = ["n", "data"]
 
    def __init__(self, li):
        self.n = len(li) + 1
        self.data = [0] + li
        for i in range(1, self.n):
            if i + (i & -i) < self.n:
                self.data[i + (i & -i)] += self.data[i]
 
    def add(self, i, a):
        i += 1
        while i < self.n:
            self.data[i] += a
            i += i & -i
        
    def acc(self, i):
        res = 0
        while i > 0:
            res += self.data[i]
            i -= i & -i
        return res
    
    def fold(self, l, r):
        res = 0
        while l < r:
            res += self.data[r]
            r -= r & -r
        while r < l:
            res -= self.data[l]
            l -= l & -l
        return res

import bisect
n = int(input())
TF = []
for _ in range(n):
  s = input()
  if "." not in s:
    s += "."
  a, b = s.split(".")
  k = len(b)
  c = int(a+b)
  t = 0
  while c%2 == 0:
    c //= 2
    t += 1
  f = 0
  while c%5 == 0:
    c //= 5
    f += 1
  TF.append((t-k, f-k))
TF.sort()
ans = 0
U = 50
bit = BIT([0]*100)
temp = n
for t, f in TF:
  r = bisect.bisect_left(TF, (-t, -U))
  while temp > r:
    temp -= 1
    nt, nf = TF[temp]
    bit.add(nf+U, 1)
  ans += n-temp - bit.acc(-f+U)
for t, f in TF:
  if min(t, f) >= 0:
    ans -= 1
ans //= 2
print(ans)
### BUGGY CODE ###

K, S = map(int, input().split())

count = 0
for x in range(K+1):
    for y in range(K+1):
        if S-x-y<=K:
            for z in range(K+1):
                if x+y+z==S:
                    count += 1
print(count)

### FIXED CODE ###

K, S = map(int, input().split())

count = 0
for x in range(K+1):
    if S-x<=2*K and S-x>=0:
        for y in range(K+1):
            if S-x-y<=K and S-x-y>=0:
                count += 1
#                 for z in range(K+1):
#                     if x+y+z==S:
#                         count += 1
print(count)
### BUGGY CODE ###

import sys
input = sys.stdin.readline

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

from queue import Queue
q = Queue()
ans = Queue()

def bfs(b):
    q.put(b)
    ans.put([])

    while q.empty() == False:
        p = q.get()
        a = ans.get()

        if p == []:
            break

        m = len(p)

        for i in range(m):
            if p[i] == (i+1):
                q.put(p[:i]+p[i+1:])
                ans.put(a+[i+1])


    if p == []:
        a = a[::-1]
        for aa in a:
            print(aa)
    else:
        print(-1)


bfs(b)

### FIXED CODE ###

import sys
input = sys.stdin.readline

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

from queue import Queue
q = Queue()
ans = Queue()

import numpy as np
n = np.array(n)


def bfs(b):
    q.put(b)
    ans.put([])

    while q.empty() == False:
        p = q.get()
        a = ans.get()

        if p == []:
            break

        if p[0] != 1:
            continue

        m = len(p)

        for i in range(m-1, -1, -1):
            if p[i] == i+1:
                q.put(p[:i]+p[i+1:])
                ans.put(a+[i+1])
                break


    if p == []:
        a = a[::-1]
        for aa in a:
            print(aa)
    else:
        print(-1)


bfs(b)
### BUGGY CODE ###

mod=2019
a=input()

N=len(a)
t=[0]*mod
t[0]=1

v=0
w=1

for i in range(N):
  u=int(a[N-1-i]) * w + v
  v=u % mod
  t[v] += 1
  w *=10 % mod

ans=0
for i in t:
  ans += (i-1)*i//2

print(ans)

### FIXED CODE ###

mod=2019
a=input()

N=len(a)
t=[0]*mod
t[0]=1

w=1
u=0

for i in range(N):
  u=int(a[N-1-i]) * w + u
  v=u % mod
  t[v] += 1
  w *=10
  w %= mod

ans=0
for i in t:
  ans += (i-1)*i//2

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

n,q=map(int,input().split())
s=input()
for i in range(q):
    l,r=map(int,input().split())
    cnt=0
    for j in range(l-1,r-1):
        if s[j]=="A" and s[j+1]=="C":
            cnt+=1
    print(cnt)

### FIXED CODE ###

n,q=map(int,input().split())
s=input()
a=[0]*(n+10)
for i in range(1,n):
    if s[i-1]=="A" and s[i]=="C":
        a[i]=a[i-1]+1
    else:
        a[i]=a[i-1]
for i in range(q):
    l,r=map(int,input().split())
    print(a[r-1]-a[l-1])
### BUGGY CODE ###

n = int(input())

l = []
for s in range(n):
    i = input()
    if i not in l:
        l.append(i)

print(len(l))

### FIXED CODE ###

n = int(input())

l = set()
num = 0
for s in range(n):
    i = input()
    l.add(i)
print(len(l))