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

from collections import Counter

n = int(input())
a = map(int, input().split())
d = Counter(a)

s = sum([k*v for k, v in d.items()])

q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    if b not in d.keys():
        print(s)
        continue
    cc = 0
    if c in d.keys():
        cc = d[c]
    d[c] = cc + d[b]
    del d[b]
    s = sum([k * v for k, v in d.items()])
    print(s)


### FIXED CODE ###

from collections import Counter

n = int(input())
a = map(int, input().split())
d = Counter(a)

s = sum([k*v for k, v in d.items()])

q = int(input())
for _ in range(q):
    b, c = map(int, input().split())
    if b not in d.keys():
        print(s)
        continue
    cc = 0
    s = s + (c-b) * d[b]
    print(s)
    if c in d.keys():
        cc = d[c]
    d[c] = cc + d[b]
    del d[b]
### BUGGY CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, Q: int, S: str, l: "List[int]", r: "List[int]"):
    ans = []
    # for i in range(Q):
    #     ts = S[l[i]:r[i]].count('AC')
    #     print(S[l[i]-1:r[i]1])
    #     ans.append(ts)
    carray = [0] * N
    for i in range(1,N):
        if(S[i] == 'C' and S[i-1] == 'A'):
            carray[i] = 1
        else:
            continue

    for i in range(Q):
        # print(carray[l[i]-1:r[i]])
        ans.append(carray[l[i]:r[i]].count(1))

    for i in range(Q):
        print(ans[i])
    return


# Generated by 1.1.3 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
    Q = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    l = [int()] * (Q)  # type: "List[int]" 
    r = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        l[i] = int(next(tokens))
        r[i] = int(next(tokens))
    solve(N, Q, S, l, r)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys


def solve(N: int, Q: int, S: str, l: "List[int]", r: "List[int]"):
    ans = []
    carray = [0] * N
    for i in range(1,N):
        if(S[i-1:i+1] == 'AC'):
            carray[i] = carray[i-1]+1 
            # carray[i:] = map(lambda x:x+1, carray[i:])
        else:
            carray[i] = carray[i-1]
    # print(carray)
    for i in range(Q):
        # print(carray[l[i]-1:r[i]])
        t = carray[r[i]-1] - carray[l[i]-1]
        ans.append(t)

    for i in range(Q):
        print(ans[i])
    return


# Generated by 1.1.3 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
    Q = int(next(tokens))  # type: int
    S = next(tokens)  # type: str
    l = [int()] * (Q)  # type: "List[int]" 
    r = [int()] * (Q)  # type: "List[int]" 
    for i in range(Q):
        l[i] = int(next(tokens))
        r[i] = int(next(tokens))
    solve(N, Q, S, l, r)

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

import re
pattern = re.compile('01|10')

def remove(tower, count):
  m = pattern.split(tower)
  operation = len(m) - 1
  print(count * 2) if operation == 0 else remove(''.join(m), count + operation)  

count = 0
remove(input(), count)


### FIXED CODE ###

s = input()
zero = len([x for x in s if x == "0"])
one = len(s) - zero

print(min(zero, one) * 2)
### BUGGY CODE ###

import numpy as np

m = 998244353
N, K = map(int, input().split())
L = []
R = []
for K in range(K):
    l , r = map(int, input().split())
    L.append(l)
    R.append(r)

s = []
for i in range(len(L)):
    tmp = [n for n in range(L[i], R[i]+1)]
    s += tmp

s.sort()
ans = [1]
for i in range(1,N):
    tmp = 0
    for ss in s:
        if len(ans) < ss:
            break
#         print("i ", i)
#         print(ss)
        tmp += ans[i - ss]%m
#         print(ans)
    ans.append(tmp%m)

print(ans[-1])

### FIXED CODE ###

import numpy as np

m = 998244353
N, K = map(int, input().split())
span = []
for K in range(K):
    l , r = map(int, input().split())
    span.append([l, r])

add = [0,1]# 累積和
ans = [1]

for i in range(2,N+1):
    tmp = 0
    for s in span:
        l, r = s[0], s[1]+1
        if l > len(ans):
            continue
        elif r >= len(ans)+1:
            r = len(ans)+1
        tmp += (add[i-l] - add[i-r])%m
    ans.append(tmp%m)
    add.append(add[-1]+tmp)

print(ans[-1]%m)
### BUGGY CODE ###

import networkx as nx
n,m=map(int,input().split())
s=[list(map(int,input().split())) for i in range(m)]
 
g=nx.Graph()
g.add_nodes_from([i for i in range(1,n+1)])
 
for x in s:
    g.add_edge(x[0],x[1])
di=nx.predecessor(g,source=1)

if len(di)!=n:
    print("No")
    exit()
 
print("Yes")
for x in range(2,n+1):
    print(di[x][0])

### FIXED CODE ###

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

ans_li = [-1]*n
queue=[0]
visited = [False]*n

while queue:
    x = queue.pop(0)
    for g in map_li[x]:
        if visited[g]==False:
            queue.append(g)
            if ans_li[g]==-1:
                ans_li[g]=x
                visited[g]=True 
if -1 in ans_li[1:]:
    print('No')
else:
    print('Yes')
    for ans in ans_li[1:]:
        print(ans+1)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**7)

N, M = map(int, input().split())
g = [[int(i) for i in input().split()] for j in range(M)]

G = [[] for i in range(N)]
for i in range(M):
    a, b = g[i]
    G[a-1].append(b-1)
    G[b-1].append(a-1)

marks = [-1 for i in range(N)]
node = [[0, 0]]
while len(node) > 0:
    v = node.pop(0)
    if marks[v[0]] == -1:
        marks[v[0]] = v[1]
        for i in G[v[0]]:
            if marks[i] == -1:
                node.append([i, v[0]])

if -1 not in marks:
    print("Yes")
    for i in range(1, N):
        print(marks[i]+1)
else:
    print("No")

### FIXED CODE ###

from collections import deque

N, M = map(int, input().split())
g = [[int(i) for i in input().split()] for j in range(M)]

G = [[] for i in range(N)]
for i in range(M):
    a, b = g[i]
    G[a-1].append(b-1)
    G[b-1].append(a-1)

marks = [-1 for i in range(N)]
node = deque([[0, 0]])
while len(node) > 0:
    v = node.popleft()
    if marks[v[0]] == -1:
        marks[v[0]] = v[1]
        for i in G[v[0]]:
            if marks[i] == -1:
                node.append([i, v[0]])

if -1 not in marks:
    print("Yes")
    for i in range(1, N):
        print(marks[i]+1)
else:
    print("No")
### BUGGY CODE ###

n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

l = [[] for u in range(n + 1)]
for u, v in uv:
    l[u].append(v)

def bfs(v):
    q = [(x, 0) for x in list(v)]
    visited = set(q)
    while len(q) > 0:
        x, step = q.pop(0)
        if step == 3:
            v.add(x)
            continue
        for y in l[x]:
            next = (y, step + 1)
            if next not in visited:
                visited.add(next)
                q.append(next)
    return v

v = set([s])
ret = 0
while True:
    olen = len(v)
    v = bfs(v)
    ret += 1
    if t in v:
        break
    if len(v) == olen:
        ret = -1
        break

print(ret)

### FIXED CODE ###

n, m = map(int, input().split())
uv = [list(map(int, input().split())) for _ in range(m)]
s, t = map(int, input().split())

l = [[] for u in range(n + 1)]
for u, v in uv:
    l[u].append(v)

def bfs(v):
    q = [(x, 0) for x in list(v)]
    index = 0
    ret = set()
    while len(q) > index:
        x, step = q[index]
        index += 1
        if step == 3:
            ret.add(x)
            continue
        for y in l[x]:
            next = (y, step + 1)
            if next not in visited:
                visited.add(next)
                q.append(next)
    return ret

v = set([s])
visited = set([(s, 0)])
ret = 0
while True:
    v2 = bfs(v)
    if len(v2) == 0:
        ret = -1
        break
    ret += 1
    if t in v2:
        break
    v = v2

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

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

class unionfind():
    def __init__(self,n):
        self.li = [i for i in range(n+1)]
        self.group = [1]*(n+1)

    def find(self, x):
        while self.li[x]!=x:
            x = self.li[x]
        return x

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return;
        else:
            self.li[y] = x
            self.group[x] += self.group[y]
            self.group[y] = 1
x = unionfind(n)
ans = 0
for _ in range(m):
    a,b = map(int,input().split())
    x.union(a,b)
print(max(x.group))

### FIXED CODE ###

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

class unionfind():
    def __init__(self,n):
        self.li = [i for i in range(n+1)]
        self.group = [1]*(n+1)

    def find(self, x):
        while self.li[x]!=x:
            x = self.li[x]
        return x

    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x == y:
            return;
        elif x>y:
            self.li[y] = x
            self.group[x] += self.group[y]
        else:
            self.li[x] = y
            self.group[y] += self.group[x]
x = unionfind(n)
ans = 0
for _ in range(m):
    a,b = map(int,input().split())
    x.union(a,b)
print(max(x.group))
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
Dy = (-1,0,1,0)
Dx = (0,1,0,-1)

from collections import deque,defaultdict,Counter
def main():
    H,W,K = map(int,input().split())
    sy,sx,gy,gx = map(int,input().split())
    sy -= 1; sx -= 1; gy -= 1;gx -= 1
    pond = [list(input()) for _ in range(H)]
    
    q = deque([(sy,sx)])
    dist = [[-1]*W for _ in range(H)]
    dist[sy][sx] = 0
    while q:
        oy,ox = q.popleft()
        for dy,dx in zip(Dy,Dx):
            y,x = oy,ox
            for _ in range(K):
                y += dy
                x += dx
                if y < 0 or y >= H:
                    break
                if x < 0 or x >= W:
                    break
                if pond[y][x] == '@':
                    break
                if dist[y][x] >= 0 and dist[y][x] <= dist[oy][ox]:
                    break
                dist[y][x] = dist[oy][ox] + 1
                q.append((y,x))
                if (y,x) == (gy,gx):
                    break
    print(dist[gy][gx] if dist[gy][gx] >= 0 else -1) 
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
sys.setrecursionlimit(10000000)
MOD = 10 ** 9 + 7
INF = 10 ** 15
Dy = (-1,0,1,0)
Dx = (0,1,0,-1)

from collections import deque,defaultdict,Counter
def main():
    H,W,K = map(int,input().split())
    sy,sx,gy,gx = map(int,input().split())
    sy -= 1; sx -= 1; gy -= 1;gx -= 1
    pond = [list(input()) for _ in range(H)]
    
    q = deque([(sy,sx)])
    dist = [[-1]*W for _ in range(H)]
    dist[sy][sx] = 0
    while q:
        ny,nx = q.popleft()
        for dy,dx in zip(Dy,Dx):
            y,x = ny,nx
            for _ in range(K):
                y += dy
                x += dx
                if y < 0 or y >= H:
                    break
                if x < 0 or x >= W:
                    break
                if pond[y][x] == '@':
                    break
                if dist[y][x] >= 0 and dist[y][x] <= dist[ny][nx]:
                    break
                if dist[y][x] < 0:
                    dist[y][x] = dist[ny][nx] + 1
                    q.append((y,x))
                if (y,x) == (gy,gx):
                    break
    print(dist[gy][gx] if dist[gy][gx] >= 0 else -1) 
if __name__ == '__main__':
    main()
### BUGGY CODE ###

import numpy as np

n = int(input())
A = list(map(int, input().strip().split()))
U = max(A) + 3
c = np.zeros((U),dtype=np.int64)
for a in A:
    c[a] += 1
#print(c)


q = np.zeros((c.max() + 3),dtype=np.int64)
q[2] = 1
#q[3] = 3
#q[4] = 6
for i in range(3,len(q)):
    q[i] = int(q[i-1] * i / (i-2))
#print(q)

s = 0
dex = np.where(c>0)
for i in dex[0]:
    s += q[c[i]]
#print(s)
for i in range(n):
    #print(A[i],q[c[A[i]]],q[c[A[i]]-1])
    print(s - q[c[A[i]]] + q[c[A[i]]-1])

### FIXED CODE ###

import numpy as np
import collections

n = int(input())
A = list(map(int, input().strip().split()))
C = collections.Counter(A)
#print(C)
s = 0
for v in C.values():
    s += v * (v-1) // 2
#print(s)
#print()
for i in range(n):
    print(s - C[A[i]] + 1)
### BUGGY CODE ###

import itertools
k,s = map(int,input().split())
count = 0
for i,j,k in itertools.product(range(k+1),range(k+1),range(k+1)):
	if i+j+k == s:
		count += 1
print(count)

### FIXED CODE ###

import itertools
k,s = map(int,input().split())
count = 0
for i,j in itertools.product(range(k+1),range(k+1)):
	d = s -(i+j)
	if 0 <= d <= k:
		count += 1
		
print(count)
### BUGGY CODE ###

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

from itertools import accumulate
Cumsum = list(accumulate(A))
counter = 0
for l in range(0, N):
    for r in range(l, N):
        if l == r:
            if A[l] % M == 0:
                counter += 1
        elif l != r and l == 0:
            if Cumsum[r] % M == 0:
                counter += 1
        elif l != r and l >= 1:
            if (Cumsum[r] - Cumsum[l-1]) % M == 0:
                counter += 1


print(counter)

### FIXED CODE ###

from collections import defaultdict
N, M = map(int, input().split())
A = list(map(int, input().split()))

ans = 0
hash = defaultdict(int)
hash[0] = 1
i = 0
for a in A:
    i = (i+a) % M
    hash[i] += 1
for h in list(hash.keys()):
    ans += hash[h] * (hash[h]-1) // 2

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

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

LR = [list(map(int,input().split())) for _ in range(M)]

IDlist=[0]*N

for l,r in LR:
    for i in range(l-1,r):
        IDlist[i]+=1

print(IDlist.count(M))

### FIXED CODE ###

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

LR = [list(map(int,input().split())) for _ in range(M)]

L=0
R=N
for l,r in LR:
    if L<l:
        L=l
    if R>r:
        R=r
    #print(str(L)+str(R))

if R-L+1<0:
    print(0)
else:
    
    print(str(R-L+1))
### BUGGY CODE ###

N = int(input())
A = list(map(int,input().split()))
for i in range(1,N+1):
    print(A[i-1:].count(i))

### FIXED CODE ###

N = int(input())
A = list(map(int,input().split()))
B = [0]*N
for i in range (len(A)):
    B[A[i]-1] +=1
print('\n'.join(map(str, B)))
### BUGGY CODE ###

S = input().split()
N = int(S[0])
M = int(S[1])
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_MAX = max(A)
B_MAX = max(B)
MAX = A_MAX if (A_MAX > B_MAX) else B_MAX

mod = int(1e9 + 7)

A_F_cnt = 0
B_F_cnt = 0

result = 1
sA = set(A)
sB = set(B)

for i in range(MAX, 0, -1):
    in_A = (i in sA)
    in_B = (i in sB)
    if (in_A and in_B):
        A_F_cnt += 1
        B_F_cnt += 1
    elif (in_A):
        result *= B_F_cnt
        A_F_cnt += 1 
    elif (in_B):
        result *= A_F_cnt
        B_F_cnt += 1
    else:
        coef = ( ( A_F_cnt * B_F_cnt )%mod - (N*M - i) )
        if coef < 0:
            coef += mod
        result *= coef
        
    # print(in_A, in_B, A_F_cnt, B_F_cnt, result)

print(result % mod)



### FIXED CODE ###

S = input().split()
N = int(S[0])
M = int(S[1])
A = list(map(int, input().split()))
B = list(map(int, input().split()))

A_MAX = max(A)
B_MAX = max(B)
MAX = A_MAX if (A_MAX > B_MAX) else B_MAX

mod = int(1e9 + 7)

A_F_cnt = 0
B_F_cnt = 0

result = 1
sA = [ False for _ in range(MAX+1) ]
sB = [ False for _ in range(MAX+1) ]

for i in range(len(A)):
    sA[A[i]] = True
for i in range(len(B)):
    sB[B[i]] = True


for i in range(MAX, 0, -1):
    in_A = sA[i]
    in_B = sB[i]
    if (in_A and in_B):
        A_F_cnt += 1
        B_F_cnt += 1
    elif (in_A):
        result *= B_F_cnt
        result %= mod
        A_F_cnt += 1 
    elif (in_B):
        result *= A_F_cnt
        result %= mod
        B_F_cnt += 1
    else:
        coef = ( ( A_F_cnt * B_F_cnt )%mod - (N*M - i) )
        if coef < 0:
            coef += mod
        result *= coef
        result %= mod
        
    # print(in_A, in_B, A_F_cnt, B_F_cnt, result)

print(result % mod)
### BUGGY CODE ###

# coding: utf-8
# Your code here!
import bisect

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

zero=bisect.bisect_left(X,0)

ans=10**18
start=max(0,zero-K)
for i in range(start,start+N-K+1):
    temp=X[i:i+K]
    m=min(0,min(temp))
    M=max(0,max(temp))
    ans=min((abs(m)+abs(M)*2),(abs(m)*2+abs(M)),ans)
    
print(ans)



### FIXED CODE ###

# coding: utf-8
# Your code here!
import bisect

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

zero=bisect.bisect_left(X,0)

ans=10**18
start=max(0,zero-K)
for i in range(start,start+N-K+1):
    #print(i)
    m=min(0,X[i])
    M=max(0,X[i+K-1])
    ans=min((abs(m)+abs(M)*2),(abs(m)*2+abs(M)),ans)
    if i+K==N:
        break
    
print(ans)
### BUGGY CODE ###

import numpy as np
N, M = map(int, input().split())
A = sorted([int(x) for x in input().split()])
card = np.zeros(N)
for i in range(N):
    card[i] = A[i]

for j in range(M):
    B, C = map(int, input().split())
    for k in range(B):
        card = np.append(card, C)
card = sorted(card, reverse=True)

ans = 0
for h in range(N):
    ans += card[h]
print("{}".format(int(ans)))


### FIXED CODE ###

# 未完成　要素と個数を別にしてソートすればいける？
N, M = map(int, input().split())
A = [int(x) for x in input().split()]
cardnumberlist = []
card_dict = {}
for i in range(N):
    if A[i] in card_dict:
        card_dict[A[i]] += 1
    else:
        card_dict[A[i]] = 1
        cardnumberlist.append(A[i])

for j in range(M):
    B, C = map(int, input().split())
    if C in card_dict:
        card_dict[C] += B
    else:
        card_dict[C] = B
        cardnumberlist.append(C)
ans = 0
cardnumberlist = sorted(cardnumberlist, reverse=True)
# print(cardnumberlist)
# print(card_dict)
numofcard = 0
for h in range(N):
    #print(h)
    if numofcard + card_dict[cardnumberlist[h]] > N:
        ans += cardnumberlist[h] * (N - numofcard)
        break
    else:
        ans += cardnumberlist[h] * card_dict[cardnumberlist[h]]
        numofcard += card_dict[cardnumberlist[h]]
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(1000000000)

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

A = [-1]*M
B = [-1]*M
C = [-1]*M
back_edges = [[] for _ in range(N)]
forward_edges = [[] for _ in range(N)]
fb = [0]*N
past = set()
availables = set()

for edge in range(M):
    a, b, c = map(int, input().split())
    A[edge] = a-1
    B[edge] = b-1
    C[edge] = c-P
    forward_edges[a-1].append(edge)
    back_edges[b-1].append(edge)

def forward(node):
    if node in availables:
        return
    availables.add(node)
    edges = forward_edges[node]
    past.add(node)
    for edge in edges:
        forward(B[edge])
    past.discard(node)

forward(0)

def back(node):
    edges = back_edges[node]
    past.add(node)
    coin = -float('inf') if node != 0 else 0
    for edge in edges:
        a = A[edge]
        if a not in availables:
            continue
        c = C[edge]
        if a in past:
            if fb[a] < c + fb[node]:
                print(-1)
                sys.exit()
            continue
        fb[a] = c + fb[node]
        coin = max(back(a)+c, coin)
    past.discard(node)
    return coin

ans = back(N-1)
ans = 0 if ans < 0 else ans
print(ans)

### FIXED CODE ###

import sys
import time
from queue import Queue
limit_time = time.time() + 1.70
input = sys.stdin.readline
sys.setrecursionlimit(1000000000)

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

A = [-1]*M
B = [-1]*M
C = [-1]*M
nodes_edges = [[] for _ in range(N)]
rev_nodes_edges = [[] for _ in range(N)]
coin = [-float('inf')]*N
coin[0] = 0
availables = set()

for edge in range(M):
    a, b, c = map(int, input().split())
    A[edge] = a-1
    B[edge] = b-1
    C[edge] = c-P
    nodes_edges[a-1].append(edge)
    rev_nodes_edges[b-1].append(edge)

def cut_graph(node):
    edges = rev_nodes_edges[node]
    availables.add(node)
    for edge in edges:
        prev = A[edge]
        if prev in availables:
            continue
        cut_graph(prev)

cut_graph(N-1)
q = Queue()
q.put(0)
count = 0
limit = M*(1+len(availables))
while not q.empty():
    if time.time() >= limit_time:
        print(-1)
        break
    node = q.get()
    edges = nodes_edges[node]
    for edge in edges:
        nxt = B[edge]
        if nxt not in availables:
            continue
        new_coin = C[edge]+coin[node]
        if new_coin > coin[nxt]:
            coin[nxt] = new_coin
            q.put(nxt)
    count += 1
else:
    ans = coin[N-1]
    ans = 0 if ans < 0 else ans
    print(ans)
### BUGGY CODE ###

from math import floor

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

ans = 0
for x in range(1,N+1):
    tmp = floor(A*x/B)-A*floor(x/B)
    if tmp > ans:
        ans = tmp

print(ans)


### FIXED CODE ###

from math import floor

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

def f(x):
    return floor(A*x/B)-A*floor(x/B)

print(f(min(B-1,N)))
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
result=1
if 0 in a:
    print(0)
else:
    for i in a:
        result*=i
    if i>10**18:
        print(-1)
    elif result>10**18:
        print(-1)
    else:
        print(result)


### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
result=1
if 0 in a:
    print(0)
else:
    for i in a:
        result*=i
        if result>10**18:
            print(-1)
            break
    if result<=10**18:
        print(result)
### BUGGY CODE ###

N, K, Q = map(int, input().split())
#print(N, K, Q)
listq = []
for i in range(Q):
    ai = int(input())
    listq.append(ai)
#print(listq)    
for n in range(N):
    num = listq.count(n+1)
    ansn = K - Q + num
    if ansn>0:
        print('Yes')
    else:
        print('No')    


### FIXED CODE ###

N, K, Q = map(int, input().split())
#print(N, K, Q)
listq = [0]*N
for i in range(Q):
    ai = int(input())
    listq[ai-1] += 1
#print(listq)    
for n in range(N):
    num = listq[n]
    ansn = K - Q + num
    if ansn>0:
        print('Yes')
    else:
        print('No')
### BUGGY CODE ###

def main():
    n = int(input())
    A = list(map(int, input().split()))

    res = 0
    i = 1

    while i < len(A) - 1:
        if (A[i - 1] < A[i] and A[i] > A[i + 1]) or (A[i - 1] > A[i] and A[i] < A[i + 1]):
            res += 1
            A = A[i + 1:]
            i = 1
        else:
            i += 1
    
    print(res + 1)

if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    n = int(input())
    A = list(map(int, input().split()))

    res = 1
    inc = 0
    dec = 0

    for i in range(n - 1):
        if A[i] < A[i+1]:
            inc += 1
        elif A[i] > A[i+1]:
            dec += 1
        
        if inc and dec:
            res += 1
            inc, dec = 0, 0
    
    print(res)

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

N = int(input())
A = []
for _ in range(N):
    A.append(int(input()))
C = set(A)
B = [0]*N
i = 0
for a in C:
    B[i] += A.count(a)
    i += 1
B = [i%2 for i in B]
print(B.count(1))


### FIXED CODE ###

N = int(input())
A = [int(input()) for _ in range(N)]
B = {}
for i in A:
    if i not in B:
        B[i] = 1
    else:
        if B[i] == 1:
            B[i] -= 1
        else:
            B[i] += 1
cnt = 0
for j in B.keys():
    if B[j] == 1:
        cnt += 1
print(cnt)