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



tmp = input().split(" ")
n = tmp[0]
q = int(tmp[1])

s = input()

for i in range(q):
    tmp = input().split(" ")
    a = int(tmp[0]) - 1
    b = int(tmp[1])
    sub = s[a:b]
    arr = sub.split("AC")
    print(len(arr) - 1)


### FIXED CODE ###

import math
from functools import reduce
from collections import deque
import sys
sys.setrecursionlimit(10**7)

def input():
    return sys.stdin.readline().strip()

# スペース区切りの入力を読み込んで数値リストにして返します。
def get_nums_l():
    return [ int(s) for s in input().split(" ")]

# 改行区切りの入力をn行読み込んで数値リストにして返します。
def get_nums_n(n):
    return [ int(input()) for _ in range(n)]

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

def rangeI(it, l, r):
    for i, e in enumerate(it):
        if l <= i < r:
            yield e
        elif l >= r:
            break

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

INF = 999999999999999999999999
MOD = 10**9+7

n,q = get_nums_l()
s = input()

ruiseki_ac = [0] * (n+1)

for i in range(n-1):
    x = 0
    if s[i] == "A" and s[i+1] == "C":
        x = 1
    ruiseki_ac[i+1] = ruiseki_ac[i] + x
ruiseki_ac[n] = ruiseki_ac[n-1]

log(ruiseki_ac)

for i in range(q):

    a,b = get_nums_l()
    print(ruiseki_ac[b-1] - ruiseki_ac[a-1])
### BUGGY CODE ###

import sys
input = sys.stdin.readline

n, m = [int(x) for x in input().split()]
g = [[] for _ in range(n)]

for _ in range(m):
    l, r, d = [int(x) for x in input().split()]
    g[l - 1].append((r - 1, d))
    g[r - 1].append((l - 1, -d))

d = [0] * n
visited = [0] * n

for i in range(n):
    if visited[i] != 0:
        continue
    stack = [i]
    d[i] = 1
    while stack:
        u = stack.pop()
        visited[u] = 1
        for v, d_ in g[u]:
            if d[v] == 0:
                d[v] = d[u] + d_
                stack.append(v)
            else:
                if d[v] != d[u] + d_:
                    print("No")
                    sys.exit()
print("Yes")


### FIXED CODE ###

n, m = map(int, input().split())
ed = [[] for _ in range(n)]  # グラフ
v = [None] * n
for _ in range(m):
  l, r, d = map(int, input().split())
  ed[l-1].append((r-1, d))  # l -> r
  ed[r-1].append((l-1, -d))  # r -> l

visited = [False] * n  # 訪問フラグ（非連結の可能性の為）

def dfs(start):
  s = [start]
  v[start] = 0
  while s:
    label = s.pop()
    if visited[label] == False:
      visited[label] = True
      for to, dist in ed[label]:
        if v[to] is None:
          v[to] = v[label] + dist
          s.append(to)
        else:
          if v[to] != v[label] + dist:
            return False
  return True

is_exist = True
for i in range(n):
  if v[i] is None:
    if not dfs(i):
      print('No')
      is_exist = False
      break
if is_exist:
  print("Yes")
### BUGGY CODE ###

# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
ans = ""
for i in range(N):
    if i % 2 == 0:
        ans += str(A[i])
    else:
        ans = str(A[i]) + ans
if N % 2 != 0:
    for i in range(N-1, -1, -2):
        print(A[i], end=" ")
    for i in range(1, N, 2):
        print(A[i], end=" ")
else:
    for i in range(N-1, 0, -2):
        print(A[i], end=" ")
    for i in range(0, N, 2):
        print(A[i], end=" ")

### FIXED CODE ###

# coding: utf-8
N = int(input())
A = list(map(int, input().split()))
if N % 2 != 0:
    for i in range(N-1, -1, -2):
        print(A[i], end=" ")
    for i in range(1, N, 2):
        print(A[i], end=" ")
else:
    for i in range(N-1, 0, -2):
        print(A[i], end=" ")
    for i in range(0, N, 2):
        print(A[i], end=" ")
### BUGGY CODE ###

from itertools import permutations
n, m, r = map(int, input().split())
towns = [int(x) - 1 for x in input().split()]
inf = 10 ** 10
d = [[inf for _ in range(n)] for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c

def warshall_floyd(d, v):
    for k in range(v):
        for i in range(v):
            for j in range(v):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

warshall_floyd(d, n)
ans = 10 ** 10
for t in permutations(towns):
    tmp = 0
    for i in range(len(t) - 1):
        tmp += d[t[i]][t[i+1]]
    ans = min(ans, tmp)


print(ans)

### FIXED CODE ###

from itertools import permutations
n, m, r = map(int, input().split())
towns = [int(x) - 1 for x in input().split()]
inf = 10 ** 10
d = [[inf for _ in range(n)] for _ in range(n)]
for _ in range(m):
    a, b, c = map(int, input().split())
    d[a-1][b-1] = c
    d[b-1][a-1] = c

def warshall_floyd(d, v):
    for k in range(v):
        for i in range(v):
            for j in range(v):
                d[i][j] = min(d[i][j], d[i][k] + d[k][j])

warshall_floyd(d, n)
ans = 10 ** 10
for t in permutations(towns):
    tmp = 0
    for i in range(len(t) - 1):
        tmp += d[t[i]][t[i+1]]
    ans = min(ans, tmp)


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

N = int(input())
A = list(map(int, input().split()))
mod = 10**9+7

A_bin_cnt = [0] * 60
for i in range(N):
    a = A[i]
    for j in range(60):
        if a >> j & 1:
            A_bin_cnt[j] += 1
ans = 0
for i in range(N):
    a = A[i]
    for j in range(60):
        if not a >> j & 1:
            ans = (ans + (pow(2, j, mod) * A_bin_cnt[j]) % mod) % mod
        else:
            ans = (ans + (pow(2, j, mod) * (N - A_bin_cnt[j])) % mod) % mod
inv2 = pow(2, mod-2, mod)
print((ans*inv2)%mod)



### FIXED CODE ###

def main():
    N = int(input())
    A = list(map(int, input().split()))
    mod = 10**9+7

    A_bin_cnt = [0] * 60
    for i in range(N):
        a = A[i]
        for j in range(60):
            if a >> j & 1:
                A_bin_cnt[j] += 1

    ans = 0
    for i in range(60):
        ans = (ans + (pow(2, i, mod) * (A_bin_cnt[i] * (N - A_bin_cnt[i])))%mod) % mod
    print(ans)


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

import heapq

q=int(input())
res = 0

x=list(map(int,input().split()))
a=x[1]
res += x[2]
asmall = [a*-1]
alarge = [a]
heapq.heapify(asmall)
heapq.heapify(alarge)

r1 = a
r2 = a

for _ in range(q-1):
    x=list(map(int,input().split()))
    if x[0] ==1:
        a = x[1]
        res += x[2]
        if r1 <= a and a <= r2: pass
        else: res += min(abs(a-r1),abs(a-r2))
        mid1 = asmall[0] * -1
        if mid1 > a:
            heapq.heappush(alarge,heapq.heappop(asmall) * -1)
            heapq.heappush(asmall,-a)
            heapq.heappush(asmall,-a)
        else:
            mid2 = alarge[0]
            if mid2 >= a:
                heapq.heappush(asmall,-a)
                heapq.heappush(alarge,a)
            else:
                heapq.heappush(asmall,heapq.heappop(alarge) * -1)
                heapq.heappush(alarge,a)
                heapq.heappush(alarge,a)
        r1 = asmall[0] * -1
        r2 = alarge[0]
    if x[0] == 2:
        print(str(r1)+" "+str(res))

### FIXED CODE ###

import heapq
import sys 
input = sys.stdin.readline

def main():
    q=int(input())
    res = 0

    x=list(map(int,input().split()))
    a=x[1]
    res += x[2]
    asmall = [a*-1]
    alarge = [a]
    heapq.heapify(asmall)
    heapq.heapify(alarge)

    r1 = a
    r2 = a

    for _ in range(q-1):
        x=list(map(int,input().split()))
        if x[0] ==1:
            a = x[1]
            res += x[2]
            if r1 <= a and a <= r2: pass
            else: res += min(abs(a-r1),abs(a-r2))
            mid1 = asmall[0] * -1
            if mid1 > a:
                heapq.heappush(alarge,heapq.heappop(asmall) * -1)
                heapq.heappush(asmall,-a)
                heapq.heappush(asmall,-a)
            else:
                mid2 = alarge[0]
                if mid2 >= a:
                    heapq.heappush(asmall,-a)
                    heapq.heappush(alarge,a)
                else:
                    heapq.heappush(asmall,heapq.heappop(alarge) * -1)
                    heapq.heappush(alarge,a)
                    heapq.heappush(alarge,a)
            r1 = asmall[0] * -1
            r2 = alarge[0]
        if x[0] == 2:
            print(str(r1)+" "+str(res))

main()
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
for i in list([int(a.index(i))+1 for i in range(1,n+1)]):
    print(i,end=" ")

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
d = dict(zip(a,range(1,n+1)))
for i in range(1,n+1):
    print(d[i],end=" ")
### BUGGY CODE ###

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

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

ans = [0]*(N+1)
que = [1]

while len(route) > 0 and len(que) > 0:
    temp = []
    del_l = []
    for i, (a, b) in enumerate(route):
        if a in que and b not in que:
            ans[b] = a
            temp.append(b)
            del_l.append(i)
        if b in que and a not in que:
            ans[a] = b
            temp.append(a)
            del_l.append(i)
    route = [r for r in route if route.index(r) not in del_l]
    que = temp

answer = ['Yes'] + ans[2:]

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


### FIXED CODE ###

from collections import deque

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

G = [[] for _ in range(N+1)]
m = [tuple(map(int, input().split())) for _ in range(M)]

for a, b in m:
    G[a].append(b)
    G[b].append(a)

par = [0] * (N + 1)
visited = [0] * (N + 1)
root = 1
visited[root] = 1
q = deque([root])

while q:
    v = q.popleft()
    for w in G[v]:
        if visited[w]:
            continue
        visited[w] = 1
        par[w] = v
        q.append(w)
print('Yes')
print(*par[2:], sep='\n')
### BUGGY CODE ###

def ncr(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n-r] % p

N, a, b = map(int, input().split())
p = 10 ** 9 + 7
"N = 10 ** 6  # N は必要分だけ用意する"
fact = [1, 1]
factinv = [1, 1]
inv = [0, 1]
 
for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

 
al = 2**N -1
acr = ncr(N, a, p)
bcr = ncr(N, b, p)
print(al-acr-bcr)

### FIXED CODE ###

mod = 7+10**9
def ncr(n,c,mod):
  x = 1
  y = 1
  for i in range(n-c+1,n+1):
    x = x*i%mod
  for j in range(1,c+1):
    y = y*j%mod
  return (x * pow(y, mod-2, mod)) % mod

n, a, b = map(int, input().split())
al = pow(2, n, mod) -1
acr = ncr(n, a, mod)
bcr = ncr(n, b, mod)
print( (al-(acr+bcr))%mod )
### BUGGY CODE ###

"""
ナップサック問題
"""
N,W = map(int, input().split())
dp = [[-1 for i in range(100100)] for j in range(N+1)]
dp[0][0] = 0
for i in range(N):
    w, v = map(int, input().split())
    for j in range(W):
        dp[i+1][j] = max(dp[i+1][j], dp[i][j])
        if dp[i][j] == -1:
            continue
        elif j+w <= W:
            # print("i:{},j:{},value1:{}".format(i,i+j,max(dp[i][j]+v, dp[i][j+w])))
            dp[i+1][j+w] = max(dp[i][j]+v, dp[i][j+w])
            # print(dp[i+1][j+w],i+1,j+w)
 
print(max(dp[N][:W+1]))

### FIXED CODE ###


import numpy as np
N,W = map(int, input().split())
# np.maximum https://www.sejuku.net/blog/69175
# 第一引数と第二引数の大小関係を要素ごとに比較して、大きい方を格納した配列を返します。
dp = np.zeros(W+1, dtype=np.int64)
for _ in range(N):
    w,v = map(int,input().split())
    # w以下ならvを足したもの、w以上ならそのままの値で、最大値を求める
    # 出力はw以上の配列として返す(それ以下は重さwなので関与しない)
    # 足す場合が前者、足さない場合が後者。その重さでの最大valueが保存されている
    np.maximum(dp[:W-w+1]+v,dp[w:],out=dp[w:]) 

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

from itertools import combinations
N = int(input())
L = [i for i in map(int, input().split())]
ans = 0

# print(list(combinations(L,3)))

for i, j ,k in list(combinations(L, 3)):
    if i < j + k and j < i + k and k < i + j:
        ans += 1
print(ans)


### FIXED CODE ###

import sys
import bisect
N = int(input())
L = [i for i in map(int, input().split())]
ans = 0

L.sort()
#print(L)
if N == 3:
    if L[0] + L[1] > L[2]:
        print("1")
        sys.exit()

for i in range(len(L)-2):
    for j in range(i+1,len(L)-1):
        index = bisect.bisect_left(L,L[i]+L[j],j+1)
        #print(index)
        ans += (index - 1) - (j + 1) + 1
print(ans)
### BUGGY CODE ###

import bisect
N,Q = (int(x) for x in input().split())

stop_arr = [(0,0,0) for _ in range(N)]
for i in range(N):
    S,T,X = (int(x) for x in input().split())
    stop_arr[i] = (S,T,X)
Q_arr = [0 for _ in range(Q)]
for i in range(Q):
    Q_arr[i] = int(input())

stop_arr.sort(key=lambda x:x[2], reverse=True)

ans_arr = [-1]*Q

for s,t,x in stop_arr:
    q_start = bisect.bisect_left(Q_arr, s-x)
    q_stop = bisect.bisect_left(Q_arr, t-x)
    for i in range(q_start, q_stop):
        ans_arr[i] = x

for a in ans_arr:
    print(a)


### FIXED CODE ###

import bisect

N,Q = (int(x) for x in input().split())

stop_arr = [tuple(map(int, input().split())) for _ in range(N)]
Q_arr = [int(input()) for _ in range(Q)]

stop_arr_ind = list(range(N))
stop_arr_ind.sort(key=lambda x:stop_arr[x][2])
# stop_arr.sort(key=lambda x:x[2], reverse=True)
ans_arr = [-1]*Q
skip_arr = [-1]*(Q+1)

def update_skip(skip_arr, x):
    if skip_arr[x] == -1:
        return x
    x_dest = update_skip(skip_arr, skip_arr[x])
    skip_arr[x] = x_dest
    return x_dest

for i in stop_arr_ind:
    s,t,x = stop_arr[i]
    q_start = bisect.bisect_left(Q_arr, s-x)
    q_stop = bisect.bisect_left(Q_arr, t-x)
    l = q_start
    while l < q_stop:
        if skip_arr[l] == -1:
            skip_arr[l] = q_stop
            ans_arr[l] = x
            l += 1
        else:
            l = update_skip(skip_arr, l)

print(*ans_arr, sep="\n")
### BUGGY CODE ###

import itertools
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [a[0]]
for i in range(n-1):
    b.append(b[i]+a[i+1])
c1 = list(itertools.combinations(range(n),2))
s = a
for i in c1:
    s.append(b[i[1]]-b[i[0]]+a[i[0]])
c2 = list(itertools.combinations(range(len(s)),k))
max=0
for i in c2:
    t = s[i[0]]
    for j in i:
        t = t&s[j]
    if max < t:
        max = t
print(max)


### FIXED CODE ###

import itertools
n,k = map(int,input().split())
a = list(map(int,input().split()))
b = [a[0]]
for i in range(n-1):
    b.append(b[i]+a[i+1])
c = list(itertools.combinations(range(n),2))
s = a
for i in c:
    s.append(b[i[1]]-b[i[0]]+a[i[0]])
s.sort(reverse=True)
l = len(bin(s[0]))-2
d = 1<<l-1
t = 0
while d>0:
    s1 = []
    if s[k-1] >= d:
        t += d
        for i in s:
            if i >= d:
                s1.append(i)
            else:
                s=s1
                break
    for i in range(len(s)):
        if s[i] >= d:
            s[i] -= d
        else:
            s.sort(reverse=True)
            break
    d //= 2
print(t)
### BUGGY CODE ###

#!/usr/bin/env python

x, y = map(int, input().split())
tmp = x 

if x == y:
    print(-1)
    exit()

while True:
    x += tmp 
    if x%y != 0:
        print(x)
        exit()


### FIXED CODE ###

#!/usr/bin/env python

x, y = map(int, input().split())
tmp = x 

if x%y == 0:
    print(-1)
    exit()

while True:
    x += tmp 
    if x%y != 0:
        print(x)
        exit()
### BUGGY CODE ###

n,m=map(int,input().split())
A=[int(i) for i in input().split()]
if 2 in A and 3 in A:
  A.remove(2)
if 3 in A and 5 in A:
  A.remove(3)
if 2 in A and 5 in A:
  A.remove(2)
if 6 in A and 9 in A:
  A.remove(6)
m=len(A)
D={}
D[1]=2
D[2]=5
D[3]=5
D[4]=4
D[5]=5
D[6]=6
D[7]=3
D[8]=7
D[9]=6
DP1,DP2=[-float("inf")]*(n+1),[[]]*(n+1)
DP1[0]=0
for i in range(n):
  for j in range(m):
    if D[A[j]]<=i+1 and DP1[i+1-D[A[j]]]!=-float("inf") and DP1[i+1-D[A[j]]]+1>=DP1[i+1]:
      DP1[i+1]=DP1[i+1-D[A[j]]]+1
      x,y=0,0
      X,Y=DP2[i+1],DP2[i+1-D[A[j]]]+[A[j]]
      X.sort(reverse=True)
      Y.sort(reverse=True)
      for xx in X:
        x=x*10+xx
      for yy in Y:
        y=y*10+yy
      if y>x:
        DP2[i+1]=DP2[i+1-D[A[j]]]+[A[j]]
ans=0
DP2[n].sort(reverse=True)
for i in DP2[n]:
  ans=ans*10+i
print(ans)

### FIXED CODE ###

n,m=map(int,input().split())
A=[int(i) for i in input().split()]
if 2 in A and 3 in A:
  A.remove(2)
if 3 in A and 5 in A:
  A.remove(3)
if 2 in A and 5 in A:
  A.remove(2)
if 6 in A and 9 in A:
  A.remove(6)
m=len(A)
D={}
D[1]=2
D[2]=5
D[3]=5
D[4]=4
D[5]=5
D[6]=6
D[7]=3
D[8]=7
D[9]=6
DP=[-float("inf")]*(n+1)
DP[0]=0
for i in range(n):
  for j in range(m):
    if D[A[j]]<=i+1 and DP[i+1-D[A[j]]]!=float("inf") and DP[i+1-D[A[j]]]+1>=DP[i+1]:
      DP[i+1]=DP[i+1-D[A[j]]]+1
A.sort(reverse=True)
k=DP[n]
ans=""
cur=n
for _ in range(k):
  for j in range(m):
    if cur>=D[A[j]] and DP[cur-D[A[j]]]==DP[cur]-1:
      ans+=str(A[j])
      cur-=D[A[j]]
      break
print(ans)
### BUGGY CODE ###

import array

class Solver:

  def solve(self):
    n, k = map(int, raw_input().split())
    x = map(int, raw_input().split())
    dp = array.array('i', [1<<30] * 100100)
    dp[0] = 0
    h = array.array('i', [0] * 100100)
    for i in xrange(n):
      h[i] = x[i]

    for i in xrange(n):
      for kk in xrange(k):
        j = kk + 1
        v = dp[i] + abs(h[i] - h[i+j])
        if dp[i+j] > v:
          dp[i+j] = v

    print dp[n-1]

Solver().solve()

### FIXED CODE ###

import array

class Solver:

  def solve(self):
    n, k = map(int, raw_input().split())
    x = map(int, raw_input().split())
    y = [0] * (100100 - len(x))
    dp = array.array('i', [1<<30] * 100100)
    dp[0] = 0
    h = array.array('i', x + y)

    for i in xrange(n):
      dpi = dp[i]
      hi = h[i]
      for kk in xrange(k):
        j = kk + 1
        v = dpi + abs(hi - h[i+j])
        if dp[i+j] > v:
          dp[i+j] = v

    print dp[n-1]

Solver().solve()
### BUGGY CODE ###

n = int(input())
li = list(map(int, input().split()))
tmpIndex = li.index(1)
count = 1

for i in range(2, n+1):
    if li.index(i) < tmpIndex:
        count += 1
        tmpIndex = li.index(i)
    else:
        pass

print(count)


### FIXED CODE ###

n = int(input())
li = list(map(int, input().split()))
tmpMin = li[0]
count = 0

for i in range(n):
    if li[i] <= tmpMin:
        tmpMin = li[i]
        count += 1

print(count)
### BUGGY CODE ###

n = int(input())
num = list(map(int,input().split()))
jyun = []
for i in range(n):
    for j in range(n):
        if (i+1) == num[j]:
            jyun.append(j+1)
for i in range(n):
    print(jyun[i], end=" ")


### FIXED CODE ###

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

n=int(input())
s=input()
dic={}
cntr=s.count("R")
cntg=s.count("G")
cntb=s.count("B")
for i in range(n):
    if s[i]=="R":
        dic[i]="R"
    if s[i]=="G":
        dic[i]="G"
    if s[i]=="B":
        dic[i]="B"

cnt=0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        if 2*j-i<=n-1 and dic[i]!= dic[j] and dic[i]!=dic[2*j-i] and dic[j]!=dic[2*j-i]:
                cnt+=1
print(cntr*cntg*cntb-cnt)

        

### FIXED CODE ###

n=int(input())
s=input()
dic={}
cntr=0
cntg=0
cntb=0
for i in range(n):
    if s[i]=="R":
        dic[i]="R"
        cntr+=1
    if s[i]=="G":
        dic[i]="G"
        cntg+=1
    if s[i]=="B":
        dic[i]="B"
        cntb+=1

cnt=0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        if 2*j-i<=n-1 and dic[i]!= dic[j]:
            if dic[i]!=dic[2*j-i] and dic[j]!=dic[2*j-i]:
                cnt+=1
print(cntr*cntg*cntb-cnt)
### BUGGY CODE ###

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

T = [[0]*N for _ in range(N)]
for _ in range(M):
    l,r = map(int,input().split())
    T[l-1][r-1] += 1

def f(x,y,T):
    ret = 0
    for i in range(y):
        for j in range(x):
            ret += T[i][j]
    return ret

query = []
res = []
for _ in range(Q):
    p,q = map(int,input().split())
    res.append(f(q,q,T) - f(p-1, q ,T)- f(q, p-1, T) + f(p-1, p-1, T))

for r in res:
    print(r)

### FIXED CODE ###

import sys
from itertools import accumulate
n,m,q = map(int,input().split())
ipt = sys.stdin.readlines()
rails = [[0]*n for _ in range(n)]
for line in ipt[:m]:
    l,r = map(int,line.split())
    rails[l-1][r-1] += 1
rails = [accumulate(s) for s in rails]
rails = [list(reversed(list(accumulate(reversed(s))))) for s in zip(*rails)]
buf = []
for  line in ipt[m:]:
    p,q = map(int,line.split())
    buf.append(rails[q-1][p-1])
print('\n'.join(map(str, buf)))
### BUGGY CODE ###

r,g,b,n = map(int,input().split(' '))
rmax, gmax = n//r, n//g
count = 0
i = 0
while i <= rmax:
    j = 0
    while j <= gmax:
        if (n-i*r-j*g) >= 0 and (n-i*r-j*g)%b == 0:
            count += 1
        j += 1
    i += 1
print(count)

### FIXED CODE ###

r,g,b,n = map(int,input().split(' '))
A = [r,g,b]
A.sort()
r,g,b = A[2], A[1], A[0]
rmax, gmax = n//r, n//g
count = 0
i = 0
while i <= rmax:
    j = 0
    if g == 1:
        count += (n-i*r)+1
        j += 30000
    while (n-i*r-j*g) >= 0:
        if (n-i*r-j*g)%b == 0:
            count += 1
        j += 1
    i += 1
print(count)
### BUGGY CODE ###

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

# format関数で10進数から2進数に変換
max_digits = len(format(max(a), 'b'))  # 最大桁数

# 各位の1の数を記録していく
counter = [0]*max_digits
for i in range(n):
    for i, b in enumerate(format(a[i], 'b')[::-1]):
        counter[i] += int(b)
        
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    # 各位ごとの合計は2**k × 1の数 × 0の数
    ans += (2**i * counter[i] * (n - counter[i])) % MOD
print(ans % MOD)

### FIXED CODE ###

import numpy as np
n = int(input())
a = np.array(list(map(int, input().split())))

max_digits = 60
MOD = 10**9 + 7

ans = 0
for i in range(max_digits):
    one_num = np.count_nonzero((a >> i) & 1)
    radix_mod = 2**i % MOD
    ans += (radix_mod * one_num * (n - one_num)) % MOD
print(ans%MOD)
### BUGGY CODE ###

import bisect

N = int(input())
L = sorted(list(map(int, input().split())))

cnt = 0

for i in range(N - 2):
    for j in range(i + 1, N - 1):
        k = bisect.bisect_left(L, L[i] + L[j], lo=j + 1) - 1
        cnt += k - j

print(cnt)



### FIXED CODE ###

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


L.sort(reverse=True)
dic = {}
cnt = 0

for i in range(1, N - 1):
    p = L[i]
    for j in range(i + 1, N):
        s = p + L[j]

        if s not in dic:
            dic[s] = 1
        else:
            dic[s] += 1

for i in range(N - 2):
    p = L[i]

    if i > 0:
        for x in range(i + 1, N):
            dic[p + L[x]] -= 1

    for key, value in dic.items():
        if key > p:
            cnt += value

print(cnt)
### BUGGY CODE ###

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

### FIXED CODE ###

N = int(input())
A = map(int,input().split())
ans = 1
for x in A:
	ans *= x
	if ans > 10**18:
		ans = 10**18+1
print(-1 if ans > 10**18 else ans)
### BUGGY CODE ###

h,w=map(int,input().split())
l=[list(map(str,input())) for _ in range(h)]  
def maze(MAZE,sx,sy):
  dmap=[[h*w+1]*w for _ in range(h)]
  dmap[sx][sy]=0
  cand=[]
  cand.append([sx,sy])
  while len(cand)!=0:
    x,y=cand.pop()
    for next_y,next_x in [(y+1, x), (y, x+1), (y, x-1), (y-1, x)]:
      if 0<=next_x<=h-1 and 0<=next_y<=w-1 and MAZE[next_x][next_y]=='.':
        if dmap[x][y]+1<dmap[next_x][next_y]:
          dmap[next_x][next_y]=dmap[x][y]+1
          cand.append([next_x,next_y])
  return max([dmap[i][j] for i in range(h) for j in range(w) if dmap[i][j]<=h*w])
c=0
for ix in range(h):
  for iy in range(w):
    if l[ix][iy]!='#':
      d=maze(l,ix,iy)
      if c<d:
        c=d
print(c)

### FIXED CODE ###

from collections import deque
h,w=map(int,input().split())
l=[list(map(str,input())) for _ in range(h)]  
def maze(MAZE,sx,sy):
  dmap=[[h*w]*w for _ in range(h)]
  dmap[sx][sy]=0
  cand=deque()
  cand.append([sx,sy])
  while len(cand)!=0:
    x,y=cand.popleft()
    for next_y,next_x in [(y+1, x), (y, x+1), (y, x-1), (y-1, x)]:
      if 0<=next_x<=h-1 and 0<=next_y<=w-1 and MAZE[next_x][next_y]=='.' and dmap[next_x][next_y]==h*w:
        dmap[next_x][next_y]=min(dmap[x][y]+1,dmap[next_x][next_y])
        cand.append([next_x,next_y])
  return max([dmap[i][j] for i in range(h) for j in range(w) if dmap[i][j]<h*w])
c=0
for ix in range(h):
  for iy in range(w):
    if l[ix][iy]!='#':
      d=maze(l,ix,iy)
      if c<d:
        c=d
print(c)
### BUGGY CODE ###

n = int(input())
list_ = [int(input()) for _ in range(n)]

print(sum(list_.count(key) % 2 for key in set(list_)))



### FIXED CODE ###

n = int(input())
list_ = [int(input()) for _ in range(n)]

dict_ = dict()
for key in list_:
    dict_[key] = dict_.get(key, 0) + 1
print(sum(num % 2 for num in dict_.values()))