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

N = int(input())
ans = []
for _ in range(N):
    a = int(input())
    if a not in ans:
        ans.append(a)
    else:
        ans.remove(a)
print(len(ans))

### FIXED CODE ###

N = int(input())
ans = {}
for _ in range(N):
    a = int(input())
    if a in ans:
        ans[a] = 1 - ans[a]
    else:
        ans[a] = 1
print(sum(ans.values()))
### BUGGY CODE ###

# coding: utf-8

n, q = map(int, input().split())
s = input()

for i in range(q):
    l = list(map(int, input().split()))
    f,e = l[0]-1,l[1]
    st = s[f:e]
    print(st.count('AC'))



### FIXED CODE ###

# coding: utf-8

n, q = map(int, input().split())
s = input()

t = [0]*(n+1)
for i in range(n):
    if s[i:i+2] == 'AC':
        t[i+1] = t[i] + 1
    else:
        t[i+1] = t[i]

for i in range(q):
    l,r = (map(int, input().split()))
    ans = t[r-1] - t[l-1]
    print(ans)
### BUGGY CODE ###

s = input()
li = []
for i in range(len(s)):
    if s[i] == "A":
        for j in range(i + 1, len(s)):
            if s[j] == "Z":
                li.append(j - i + 1)
print(max(li))

### FIXED CODE ###

s = input()
for i in range(len(s)):
    if s[i] == "A":
        start = i
        break
for j in range(len(s) - 1, -1, -1):
    if s[j] == "Z":
        end = j
        break
print(end - start + 1)
### BUGGY CODE ###

n = int(input())
s = []
c = []
s_dash = []
ans = 0

for i in range(n):
	s.append(input())
	c.clear()
	for j in s[i]:
		c.append(j)

	c.sort()
	c_str = ''
	for j in range(10):
		c_str += c[j]

	s_dash.append(c_str)

s_dash.sort()
for i in range(n):
	for j in range(i+1,n):
		if s_dash[i][0] != s_dash[j][0]:
			break
		elif s_dash[i] == s_dash[j]:
			ans += 1

print(ans)


### FIXED CODE ###

def cmb(n, r):
	if n < r: return 0
	if r == 0: return 1
	if r == 1: return n
	if n - r < r: r = n - r

	numerator = [n - r + k + 1 for k in range(r)]
	denominator = [k + 1 for k in range(r)]

	for p in range(2,r+1):
		pivot = denominator[p - 1]
		if pivot > 1:
			offset = (n - r) % p
			for k in range(p-1,r,p):
				numerator[k - offset] /= pivot
				denominator[k] /= pivot

	result = 1
	for k in range(r):
		if numerator[k] > 1:
			result *= int(numerator[k])

	return result

n = int(input())
s = []
for _ in range(n):
	tmp = list(input())
	tmp.sort()
	s.append(tmp)

s.sort()

count = 1
ans = 0
for i in range(n-1):
	if s[i] == s[i+1]:
		count += 1
	else:
		ans += cmb(count,2)
		count = 1

if count != 1:
	ans += cmb(count,2)

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

def main():
    from fractions import gcd
    import sys

    n, m = map(int, input().split())
    s, t = input(), input()
    l = n * m // gcd(n, m)
    a = [l // n * i + 1 for i in range(n)]
    b = [l // m * i + 1 for i in range(m)]
    c = set(a) & set(b)
    for x in list(c):
        i = a.index(x)
        j = b.index(x)

        if s[i] != t[j]:
            print(-1)
            exit()
    else:
        print(l)


if __name__ == '__main__':
    main()


### FIXED CODE ###

def main():
    from fractions import gcd

    n, m = map(int, input().split())
    s, t = input(), input()
    l = n * m // gcd(n, m)
    a = [l // n * i + 1 for i in range(n)]
    b = [l // m * i + 1 for i in range(m)]
    c = set(a) & set(b)
    for x in list(c):
        i = a.index(x)
        j = b.index(x)

        if s[i] != t[j]:
            print(-1)
            exit()
    else:
        print(l)


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

import math
import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,s = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    mod = 998244353
    two = [1]*(n+1)
    for i in range(n):
        two[i+1] = two[i]*2%mod
    dp = np.zeros((n+1,s+1),dtype = int)
    for i,ai in enumerate(a):
        if ai > s:
            continue
        dp1 = np.zeros((n+1,ai),dtype=int)
        dp2 = np.zeros((1,s+1-ai),dtype=int)
        dp3 = np.array([l[:s+1-ai] for l in dp[:-1]])
        dp4 = np.block([[dp2],[dp3]])
        dp5 = np.block([dp1,dp4])
        dp += dp5
        dp[1][ai] += 1
    ans = 0
    for i in range(n+1):
        ans = (ans+(dp[i][s]*two[n-i])%mod)%mod
    print(ans)
    return

if __name__ == '__main__':
    main()


### FIXED CODE ###

import math
import numpy as np
import queue
from collections import deque,defaultdict
import heapq
from sys import stdin,setrecursionlimit
#from scipy.sparse.csgraph import dijkstra
#from scipy.sparse import csr_matrix
ipt = stdin.readline
setrecursionlimit(10**7)

def main():
    n,s = map(int,ipt().split())
    a = [int(i) for i in ipt().split()]
    mod = 998244353
    two = [1]*(n+1)
    for i in range(n):
        two[i+1] = two[i]*2%mod
    dp = np.zeros(3010,dtype = int)
    dp[0] = 1
    for i,ai in enumerate(a):
        ndp = dp*2
        ndp[ai:] += dp[:-ai]
        ndp %= mod
        dp = ndp
    print(dp[s])
    return

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

# C 
import numpy as np

# n = 127
n = int(input())

max_n = 100000
memo = np.full(max_n,999999,dtype=np.int64)
memo[0] = 0

nl6 = [1, 6, 36, 216, 1296, 7776, 46656]
nl9 = [1, 9, 81, 729, 6561, 59049]


for i in range(1,n+1):
    memo[i] = memo[i-1]+1
    k = 6
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 6
    k = 9
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 9
        
print(memo[n])

### FIXED CODE ###

# C 
# import numpy as np

# n = 127
n = int(input())

max_n = 100000
# memo = np.full(max_n,999999,dtype=np.int32)
memo = [999999]*(max_n+1)
memo[0] = 0

# nl6 = [1, 6, 36, 216, 1296, 7776, 46656]
# nl9 = [1, 9, 81, 729, 6561, 59049]


for i in range(1,n+1):
    memo[i] = memo[i-1]+1
    k = 6
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 6
    k = 9
    while i-k >= 0:
        memo[i] = min(memo[i], memo[i-k]+1)
        k *= 9
        
print(memo[n])
### BUGGY CODE ###

H,W,D=map(int,input().split())
A=[list(map(int, input().split())) for _ in range(H)]
Am=[None]*(H*W+1)
for h in range(H):
	for w in range(W):
		Am[A[h][w]] = (h, w)
Q=int(input())
for _ in range(Q):
	L,R=map(int, input().split())
	h,w=Am[L]
	ans=0
	for i in range(L, R+1, D):
		ch,cw=Am[i]
		ans+=abs(ch-h)+abs(cw-w)
		h,w=ch,cw
	print(ans)


### FIXED CODE ###

H,W,D=map(int,input().split())
A=[list(map(int, input().split())) for _ in range(H)]
Am=[None]*(H*W+1)
for h in range(H):
	for w in range(W):
		Am[A[h][w]] = (h, w)
C=[0]*(H*W+1)
for i in range(D+1, H*W+1):
	h,w=Am[i-D]
	ch,cw=Am[i]
	C[i] = C[i-D] + abs(ch-h) + abs(cw-w)
Q=int(input())
for _ in range(Q):
	L,R=map(int, input().split())
	print(C[R]-C[L])
### BUGGY CODE ###

R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N+1):
    for g in range(N+1):
        if  (N - r*R - g*G) >= 0 and  (N - r*R - g*G)%B == 0 :
            cnt +=1
            #print(r,g,(N - r*R - g*G)//B)
print(cnt)

### FIXED CODE ###

R,G,B,N = map(int,input().split())
cnt = 0
for r in range(N+1):
    for g in range(N+1):
        if  (N - r*R - g*G) >= 0 and  (N - r*R - g*G)%B == 0 :
            cnt +=1
            #print(r,g,(N - r*R - g*G)//B)
print(cnt)
### BUGGY CODE ###

def merge_sort(A):
    if len(A) <= 1:
        return A, 0
    mid = len(A) // 2
    #print A[:mid]
    #print A[mid:]
    left, lcount = merge_sort(A[:mid])
    right, rcount = merge_sort(A[mid:])
    merged, count = merge(left, right)
    return merged, lcount + rcount + count

def merge(left, right):
    lpos = 0
    rpos = 0
    rcount = 0
    merged = []
    while lpos < len(left) and rpos < len(right):
        if left[lpos] < right[rpos]:
            merged.append(left[lpos])
            lpos += 1
        else:
            merged.append(right[rpos])
            rpos += 1
            rcount += len(left[lpos:])
    
    if left[lpos:]:
        merged.extend(left[lpos:])
    if right[rpos:]:
        merged.extend(right[rpos:])
    
    return merged, rcount

if __name__ == '__main__':
    n = int(raw_input())
    A = map(long, raw_input().split())
    
    sorted, count = merge_sort(A)
    #print ' '.join(str(x) for x in sorted)
    print count

### FIXED CODE ###

from array import array

def merge_sort(A):
    if len(A) <= 1:
        return A, 0
    mid = len(A) // 2
    left, lcount = merge_sort(A[:mid])
    right, rcount = merge_sort(A[mid:])
    merged, count = merge(left, right)
    return merged, lcount + rcount + count

def merge(left, right):
    lpos = 0
    rpos = 0
    rcount = 0
    merged = array('I', [])  # List is too slow. Use an array instead.
    len_left = len(left)
    len_right = len(right)
    while lpos < len_left and rpos < len_right:
        if left[lpos] < right[rpos]:
            merged.append(left[lpos])
            lpos += 1
        else:
            merged.append(right[rpos])
            rpos += 1
            #rcount += len(left[lpos:])
            rcount += len_left - lpos
    
    if left[lpos:]:
        merged.extend(left[lpos:])
    if right[rpos:]:
        merged.extend(right[rpos:])
    
    return merged, rcount
    
if __name__ == '__main__':
    n = int(raw_input())
    A = array('I', map(int, raw_input().split()))
    
    sorted, count = merge_sort(A)
    #print ' '.join(str(x) for x in sorted)
    print count
### BUGGY CODE ###

import sys

def main():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    S = input()
    tr = [list(map(int, input().split())) for i in range(Q)]
    
    [print(S[l[0]-1:l[1]].count('AC')) for l in tr ]
    
if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys

def main():
    input = sys.stdin.readline
    N, Q = map(int, input().split())
    S = input()
    t = [0] * (N + 1)
    
    for i in range(N):
        t[i + 1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)
    
    for i in range(Q):
        start, end = map(int, input().split())
        print(t[end - 1] - t[start - 1])
    
    
if __name__ == '__main__':
    main()
### BUGGY CODE ###

S = list(input())
dp = [ [0]*2020 for _ in range(len(S)+1) ]
dp[0][0] = 1
for i in range(1,len(S)+1):
    for j in range(2019):
        dp[i][(j*10+int(S[i-1]))%2019] += dp[i-1][j]
    if i != 1:
        dp[i][int(S[i-1])] += 1
ans = 0
for i in range(1,len(S)+1):
    ans += dp[i][0]
print(ans)

### FIXED CODE ###

from collections import Counter

S = list(input())
T = [int(S[len(S)-1])]
k = int(S[len(S)-1])
for i in range(len(S)-2,-1,-1):
    k = (int(S[i])*pow(10,len(S)-i-1,2019) + k ) % 2019
    T.append(k)

A = Counter(T)
ans = 0
ans += A.get(0,0)
for i in A.values():
    ans += i*(i-1)//2
print(ans)
### BUGGY CODE ###

K,S=map(int,input().split())
num=0
for i in range(K+1):
    for j in range(K+1):
        for k in range(K+1):
            if i+j+k==S:
                num+=1
print(num)


### FIXED CODE ###

K,S=map(int,input().split())
num=0
for i in range(K+1):
    for j in range(K+1):
        k=S-i-j
        if 0<=k<=K:
            num+=1
print(num)
### BUGGY CODE ###

import sys
I = lambda:map(int,sys.stdin.readline().split())
pr = lambda x:sys.stdout.write(f'{x}\n')
sys.setrecursionlimit(2000000001)

def solve(n,ar,k,dp,x):
	ab = abs; s = solve; mn = min
	if x>=n-2: return dp[x]
	if dp[x] + 1: return dp[x]
	m = 1e9
	for i in range(x+1,mn(n,x+k+1)):
		t = ab(ar[x]-ar[i])+s(n,ar,k,dp,i)
		m = min(m,t)
	dp[x] = m	#n([*map(lambda i:ab(ar[x]-ar[i])+solve(n,ar,k,dp,i), range(x+1,)])
	return dp[x]

def main():
	(n,k), ar = [[*map(int,s.split())] for s in [*open(0)]]
	dp = [-1]*(n-2)
	dp.append(abs(ar[-2]-ar[-1]))
	dp.append(0)
	pr(solve(n,ar,k,dp,0))

main()

### FIXED CODE ###

import sys
from functools import reduce
sys.setrecursionlimit(2000000001)

def solve(n,k,ar,dp,x):
	ab = abs; mn = min
	if x>=n-2: return dp[x]
	if not dp[x] is -1: return dp[x]
	# t = [ for i in range(x+1,mn(n,x+k+1))]
	t = map(lambda i:ab(ar[x]-ar[i])+solve(n,k,ar,dp,i), range(x+1,mn(n,x+k+1)))
	dp[x] = reduce(lambda a,b : a if a < b else b,t)
	return dp[x]

def main():
	I = lambda:map(int,sys.stdin.readline().split())
	pr = lambda x:sys.stdout.write(f'{x}\n')
	n,k, ar = *I(), [*I()]
	dp = [-1]*(n-2) + [abs(ar[-2]-ar[-1]),0]
	pr(solve(n,k,ar,dp,0))

main()
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

def dfs(x, seen):
  seen.add(x)
  for i in G[x]:
    if i in seen:
      continue
    dfs(i, seen)

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

S = set()
G = [[] for i in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  A -= 1
  B -= 1
  G[A].append(B)
  G[B].append(A)
  S.add(A)
  S.add(B)

R = []
while len(S) != 0:
    seen = set()
    dfs(S.pop(), seen)
    R.append(seen)
    S = S - seen

Block = [set() for i in range(N)]
for _ in range(K):
  C, D = map(int, input().split())
  Block[C-1].add(D-1)
  Block[D-1].add(C-1)

seq = [0]*N

for r in R:
    lr = len(r)
    for j in r:
        seq[j] =  lr - len(G[j]) - len(r&Block[j]) - 1

print(*seq)


### FIXED CODE ###

import sys
sys.setrecursionlimit(10 ** 9)

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

Friend = [[] for i in range(N)]
for _ in range(M):
  A, B = map(int, input().split())
  Friend[A-1].append(B-1)
  Friend[B-1].append(A-1)

Block = [set() for i in range(N)]
for _ in range(K):
  C, D = map(int, input().split())
  Block[C-1].add(D-1)
  Block[D-1].add(C-1)


def dfs(x):
    if seen[x] == 0:
        R[cnt].add(x)
        seen[x]=1
        for i in Friend[x]:
            dfs(i)

seen = [0]*N
cnt  = 0
R    = []
for i in range(N):
    if seen[i] == 0:
        R.append(set())
        dfs(i)
        cnt += 1

seq = [0]*N

for r in R:
    lr = len(r)
    for j in r:
        seq[j] = lr - len(Friend[j]) - len(r&Block[j]) - 1

print(*seq)
### BUGGY CODE ###

n,m = map(int,input().split())
A = list()
for i in range(m):
    a = int(input())
    A.append(a)
dp = [0]*(n+1)
dp[0] = 1
if 1 not in A:
    dp[1] = 1
for i in range(2,n+1):
    if i not in A:
        dp[i] = dp[i-2] + dp[i-1]
        dp[i] = dp[i]%1000000007
print(dp[-1]%1000000007)

### FIXED CODE ###

n,m = map(int,input().split())
A = list()
for i in range(m):
    a = int(input())
    A.append(a)
dp = [0]*(n+1)
dp[0] = 1
if 1 in A:
  del A[0]
else:
  dp[1] = 1
for i in range(2,n+1):
    if len(A) != 0:        
        if i != A[0]:
            dp[i] = dp[i-2] + dp[i-1]
            dp[i] = dp[i]%1000000007
        else:
          del A[0]
    else:
        dp[i] = dp[i-2] + dp[i-1]
        dp[i] = dp[i]%1000000007
print(dp[-1]%1000000007)
### BUGGY CODE ###

from collections import deque

INF = -1

sizeI, sizeJ = map(int, input().split())
a = [input().rstrip() for _ in range(sizeI)]

def bfs(startI, startJ, targetI, targetJ):
    dist = [[INF for _ in range(sizeJ)] for _ in range(sizeI)]
    dist[startI][startJ] = 0
    q = deque([(startI, startJ)])
    while q:
        i, j = q.pop()
        curDist = dist[i][j]
        if (i, j) == (targetI, targetJ):
            return curDist
        for di, dj in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            ni, nj = i + di, j + dj
            if 0 <= ni < sizeI and 0 <= nj < sizeJ and dist[ni][nj] == INF and a[ni][nj] == '.':
                dist[ni][nj] = 1 + curDist
                q.appendleft((ni, nj))
    raise Exception

points = []
for i in range(sizeI):
    for j in range(sizeJ):
        if a[i][j] == '.':
            points.append((i, j))
ret = 0
for i in range(len(points) - 1):
    for j in range(i + 1, len(points)):
        ret = max(ret, bfs(points[i][0], points[i][1], points[j][0], points[j][1]))
print(ret)

### FIXED CODE ###

from collections import deque

INF = -1

sizeI, sizeJ = map(int, input().split())
a = [input().rstrip() for _ in range(sizeI)]

def bfs(startI, startJ):
    dist = [[INF for _ in range(sizeJ)] for _ in range(sizeI)]
    dist[startI][startJ] = 0
    q = deque([(startI, startJ)])
    while q:
        i, j = q.pop()
        curDist = dist[i][j]
        for di, dj in ((1, 0), (-1, 0), (0, 1), (0, -1)):
            ni, nj = i + di, j + dj
            if 0 <= ni < sizeI and 0 <= nj < sizeJ and dist[ni][nj] == INF and a[ni][nj] == '.':
                dist[ni][nj] = 1 + curDist
                q.appendleft((ni, nj))
    return max([max(row) for row in dist])

ret = -float('inf')
for i in range(sizeI):
    for j in range(sizeJ):
        if a[i][j] == '.':
            ret = max(ret, bfs(i, j))
print(ret)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**9)

import numpy as np
N,W = map(int,input().split())
WV = [(list(map(int,input().split()))) for _ in range(N)]
DP = np.array([[0]*(W+1) for _ in range(N+1)], dtype=np.int64)

def rec(i,w,v):
    if DP[i][w] != 0:
        return DP[i][w]
    if i == N:
        return v
    if w == 0:
        return v
    else:
        res = rec(i+1,w,v)
        if w-WV[i][0] >= 0:
            res = max(res,rec(i+1,w-WV[i][0],v+WV[i][1]))
        DP[i][w] = res
        return DP[i][w]

rec(0,W,0)
print(np.max(DP))

### FIXED CODE ###

import numpy as np
n,w=map(int,input().split())
 
dp=np.zeros(w+1,np.int64)
for i in range(n):
    w,v = map(int,input().split())
    dp[w:] = np.maximum(dp[w:], dp[:-w] + v)
    
print(np.max(dp))
### BUGGY CODE ###

n=int(input())
a=[int(i) for i in input().split()]
b=[]
for i in a:
    b.append(i)
    b.reverse()

for i in range(n):
    if i!=n-1:
        print(b[i],end=" ")
    else:
        print(b[i])






### FIXED CODE ###

from collections import deque
n=int(input())
a=[int(i) for i in input().split()]
b=deque()
for i in range(n):
    if i%2==0:
        b.appendleft(a[i])
        
    else:
        b.append(a[i])

if n%2==0:
    b.reverse()

for i in range(n):
    if i!=n-1:
        print(b[i],end=" ")
    else:
        print(b[i])
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
ans=1
for i in range(N):
  ans*=A[i]
if ans>10**18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

import sys
N=int(input())
A=list(map(int,input().split()))
A.sort()
ans=1
for i in range(N):
  ans*=A[i]
  if ans>10**18:
    print(-1)
    sys.exit()
print(ans)
### BUGGY CODE ###

import numpy as np
from numba import njit


@njit('i8(i4, i4[:])', cache=True)
def solve(n, div):
    for i in range(2, n + 1):
        div[i::i] += 1
    return (div * np.arange(n + 1)).sum()


n = int(input())
div = np.ones(n + 1, dtype=np.int32)
print(solve(n, div))

### FIXED CODE ###

n = int(input())
div = [1] * (n + 1)

for i in range(2, n + 1):
    cnt = 1
    while i * cnt <= n:
        div[i * cnt] += 1
        cnt += 1
print(sum([x * y for x, y in enumerate(div)]))
### BUGGY CODE ###

def solve(string):
    n, m, *py = map(int, string.split())
    p = [[] for _ in range(n)]
    for _p, _y in zip(py[0::2], py[1::2]):
        p[_p - 1].append(_y)
    p = [sorted(p[i]) for i in range(n)]
    ans = []
    for _p, _y in zip(py[0::2], py[1::2]):
        ans.append("{:06}{:06}".format(_p, p[_p - 1].index(_y) + 1))
    return "\n".join(ans)


if __name__ == '__main__':
    n, m = map(int, input().split())
    print(solve("{} {}\n".format(n, m) + "\n".join([input() for _ in range(m)])))


### FIXED CODE ###

import time
import numpy as np

# def solve(n, m, py):
"""
n, m = map(int, input().split())
py = [list(map(int, input().split())) for _ in range(m)]
"""

n, m = map(int, input().split())
py = [list(map(int, input().split())) for _ in range(m)]
p = [[] for _ in range(n)]
start = time.time()
for _p, _y in py:
    p[_p - 1].append(_y)
# print(time.time() - start)
for i in range(n):
    p[i] = np.argsort(np.argsort(p[i]))

# print(time.time() - start)
counter = [0 for _ in range(n)]
for _p, _y in py:
    # print("{:06}{:06}".format(_p, p[_p - 1].index(_y) + 1))
    # t = "{:06}{:06}".format(_p, p[_p - 1].index(_y) + 1)
    # print(counter[_y])
    t = "{:06}{:06}".format(_p, p[_p - 1][counter[_p - 1]] + 1)
    print(t)
    counter[_p - 1] += 1
### BUGGY CODE ###

N, Q = map(int, input().split())
S = input()
for _ in range(Q):
  l, r = map(int, input().split())
  strin = S[l - 1:r]
  Tlis = []
  count = 0
  for i in range(len(strin) - 1):
    if strin[i] == "A":
      if strin[i + 1] == "C":
        count += 1
  print(count)

### FIXED CODE ###

import bisect
N, Q = map(int, input().split())
S = input()
lis = []
for i in range(len(S) - 1):
  if S[i] == "A" and S[i + 1] == "C":
    lis.append(i + 1)
for _ in range(Q):
  l, r = map(int, input().split())
  ko = bisect.bisect_left(lis, l)
  kk = bisect.bisect_left(lis, r)
  print(kk - ko)
### BUGGY CODE ###

import sys
def rec(N,dp,n1,n2,n3):
    if dp[n3][n2][n1]>=0.0:return dp[n3][n2][n1]
    if all([n1==0,n2==0,n3==0]):return 0.0
    res=0.0
    if n1>0:res+=rec(N,dp,n1-1,n2,n3)*n1
    if n2>0:res+=rec(N,dp,n1+1,n2-1,n3)*n2
    if n3>0:res+=rec(N,dp,n1,n2+1,n3-1)*n3
    res+=N
    res*=1.0/(n1+n2+n3)
    dp[n3][n2][n1]=res
    return dp[n3][n2][n1]
def main():
    N=int(sys.stdin.readline())
    a=tuple(map(int,sys.stdin.readline().split()))
    n1,n2,n3=a.count(1),a.count(2),a.count(3)
    dp=[[[-1.0 for _ in range(n1+n2+n3+1)] for _ in range(n2+n3+1)] for _ in range(n3+1)]
    print(rec(N,dp,n1,n2,n3))
if __name__=='__main__':main()


### FIXED CODE ###

import sys
def rec(N,dp,i,j,k):
    if dp[i][j][k]>=0.0:return dp[i][j][k]
    if all([i==0,j==0,k==0]):return 0.0
    res=0.0
    if i>0:res+=rec(N,dp,i-1,j,k)*i
    if j>0:res+=rec(N,dp,i+1,j-1,k)*j
    if k>0:res+=rec(N,dp,i,j+1,k-1)*k
    res=(res+N)*1.0/(i+j+k)
    dp[i][j][k]=res
    return dp[i][j][k]
def main():
    N=int(sys.stdin.readline())
    a=tuple(map(int,sys.stdin.readline().split()))
    n1,n2,n3=a.count(1),a.count(2),a.count(3)
    dp=[[[-1.0 for _ in range(n3+1)] for _ in range(n2+n3+1)] for _ in range(n1+n2+n3+1)]
    print(rec(N,dp,n1,n2,n3))
if __name__=='__main__':main()
### BUGGY CODE ###

n,t=map(int,input().split())
a=input().split()
for i in range(n):
    a[i]=int(a[i])

saisyo=min(a)
saidai=0
count=0

for i in range(n-1):
    x=a.pop()
    if x==saisyo:
        saisyo=min(a)
    elif x>saisyo:
        mouke=x-saisyo
        if mouke>saidai:
            saidai=mouke
            count=1
        elif mouke==saidai:
            count+=1
    
print(count)

### FIXED CODE ###

n,t=map(int,input().split())
a=list(map(int,input().split()))
saisyo=a[0]
saidai=0
count=0
for i in range(n):
    if a[i]<saisyo:saisyo=a[i]
    else:
        if a[i]-saisyo>saidai:
            saidai=a[i]-saisyo
            count=1
        elif a[i]-saisyo==saidai:
            count+=1
print(count)
### BUGGY CODE ###

import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#######ここから天ぷら########
s=deque(list(input()))
q=int(input())
rev=0
for _ in range(q):
    a=input()
    if a=="1": 
        s.reverse()
        continue
    n,m,p=map(str,a.split())
    if m=="1":
        if rev==1:
            s.append(p)
        else:
            s.appendleft(p)
    else:
        if rev==1:
            s.appendleft(p)
        else:
            s.append(p)
if rev==1:
    print("".join(list(s)[::-1]))
else:
    print(("".join(list(s))))


### FIXED CODE ###

import sys
import math
mod=10**9+7
inf=float("inf")
from math import sqrt
from collections import deque
input=lambda: sys.stdin.readline().strip()
sys.setrecursionlimit(11451419)
from functools import lru_cache
#メモ化再帰defの冒頭に毎回 @lru_cache(maxsize=10**10)
#引数にlistはだめ
#######ここまでテンプレ#######
#######ここから天ぷら########
s=deque(list(input()))
q=int(input())
rev=0
for _ in range(q):
    a=input()
    if a=="1": 
        rev=1-rev
        continue
    n,m,p=map(str,a.split())
    if m=="1":
        if rev==1:
            s.append(p)
        else:
            s.appendleft(p)
    else:
        if rev==1:
            s.appendleft(p)
        else:
            s.append(p)
if rev==1:
    print("".join(list(s)[::-1]))
else:
    print(("".join(list(s))))