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

import sys
import heapq
import copy
import numpy as np
from collections import deque

h,w=list(map(int,input().split()))
a=[['.']*w for i in range(h)]
q=deque()
cnt=0
for i in range(h):
    for j,x in enumerate(sys.stdin.readline().strip()):
        if x=='#':
            deque.append(q,[i,j])
            a[i][j]=0

while len(q)>0:
    hh,ww=deque.popleft(q)

    for nh,nw in [[hh+dh,ww+dw] for dh,dw in [[1,0],[-1,0],[0,1],[0,-1]]]:
        
        if 0>nh or nh>=h or 0>nw or nw>=w or a[nh][nw]!='.':
            continue
        
        a[nh][nw]=a[hh][ww]+1
        cnt=max(cnt,a[nh][nw])

        deque.append(q,[nh,nw])

print(cnt)


### FIXED CODE ###

from collections import deque

h,w=list(map(int,input().split()))
a=[[c for c in input()] for _ in range(h)]
visit=[[0]*w for _ in range(h)]
q=deque()

for i in range(h):
    for j in range(w):
        if a[i][j]=='#':
            deque.appendleft(q,(i,j,0))
            visit[i][j]=1
ans=0
while len(q)>0:
    i,j,cnt=deque.pop(q)

    ans=max(ans,cnt)

    for di,dj in [(-1,0),(1,0),(0,-1),(0,1)]:
        ni=i+di
        nj=j+dj
        if 0<=ni<h and 0<=nj<w and visit[ni][nj]==0:
            visit[ni][nj]=1
            deque.appendleft(q,(ni,nj,cnt+1))

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

def main():
  _map = map
  _range = range
  _len = len
  _max = max
  _input = input
  _int = int
  n, m = _map(_int, _input().split())
  d1 = {}
  for _ in _range(n):
    a, b = _map(_int, _input().split())
    if a in d1:
      d1[a].append(b)
    else:
      d1[a] = [b]
  result = 0
  d2 = {}
  maxb = -1
  for i in _range(1, m + 1):
    if i in d1:
      for j in d1[i]:
        if j not in d2:
          d2[j] = 0
        d2[j] += 1
        if j > maxb:
          maxb = j
    else:
      if _len(d2) == 0:
        continue
    result += maxb
    if d2[maxb] == 1:
      del d2[maxb]
      if _len(d2) == 0:
        maxb = 0
      else:
        maxb = _max(d2.keys())
    else:
      d2[maxb] -= 1
  print(result)
main()

### FIXED CODE ###

n, m = map(int, input().split())
d1 = {}
for _ in range(n):
  a, b = map(int, input().split())
  if a in d1:
    d1[a].append(b)
  else:
    d1[a] = [b]
result = 0
d2 = {}
maxb = -1
for i in range(1, m + 1):
  if i in d1:
    for j in d1[i]:
      if j not in d2:
        d2[j] = 0
      d2[j] += 1
      if j > maxb:
        maxb = j
  else:
    if len(d2) == 0:
      continue
  result += maxb
  if d2[maxb] == 1:
    del d2[maxb]
    if len(d2) == 0:
      maxb = 0
    else:
      maxb = max(d2.keys())
  else:
    d2[maxb] -= 1
print(result)
### BUGGY CODE ###

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

### FIXED CODE ###

N = int(input())
A = [int(e) for e in input().split()]
ans = 1
if(0 in A):
    print(0)
else:
    for i in range(N):
        ans *= A[i]
        if(ans > 10**18):
            print(-1)
            break
    else:
        print(ans)
### BUGGY CODE ###

def nyu():
    L,R = map(int,input().split())
    return L,R


def convert(LL,LR):
    LL = LL % 2019
    LR = LR % 2019

    return LL,LR

def kansu(LL,LR):

    ans = 2020

    for ll in range(LL,LR):
        for lr in range(ll+1,LR+1):
    #        print(lr)
            tmp  = (ll * lr) % 2019
            if ans > tmp:
                ans = tmp

    print(ans)

ML,MR = nyu()
#ML,MR = convert(ML,MR)
kansu(ML,MR)


### FIXED CODE ###

def nyu():
    L,R = map(int,input().split())
    return L,R


# def convert(LL,LR):
#     LL = LL % 2019
#     LR = LR % 2019

#     return LL,LR

def kansu(LL,LR):

    ans = 2020
    flg = False

    for ll in range(LL,LR):
        for lr in range(ll+1,LR+1):
            tmp  = (ll * lr) % 2019
            if ans > tmp:
                ans = tmp
                if ans == 0:
                    flg =True
                    break
        if flg == True:
            break

    print(ans)

ML,MR = nyu()
#ML,MR = convert(ML,MR)
kansu(ML,MR)
### BUGGY CODE ###

from itertools import accumulate
mod = 10 ** 9 + 7

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

memo = []
for p in range(C + 1):
    tmp = [pow(i, p, mod) for i in range(401)]
    memo.append(tuple(accumulate(tmp)))


dp = [[0] * (C + 1) for _ in range(N + 1)]
dp[0][0] = 1
for i, (a, b) in enumerate(zip(A, B)):
    for j in range(C + 1):  # 累計でj個配ったことにする
        for k in range(j + 1):  # i番目の子にk個あげる
            dp[i + 1][j] += dp[i][k] * (memo[j-k][b] - memo[j-k][a-1])
            dp[i + 1][j] %= mod

print(dp[N][C])

### FIXED CODE ###

from itertools import accumulate
mod = 10 ** 9 + 7

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

memo = []
for p in range(C + 1):
    tmp = [pow(i, p, mod) for i in range(401)]
    memo.append(tuple(accumulate(tmp)))


dp = [[0] * (C + 1) for _ in range(N + 1)]
dp[0][0] = 1
for i, (a, b) in enumerate(zip(A, B)):
    for j in range(C + 1):  # 累計でj個配ったことにする
        for k in range(j + 1):  # i番目の子にk個あげる
            dp[i + 1][j] += dp[i][k] * (memo[j-k][b] - memo[j-k][a-1])
            dp[i + 1][j] %= mod

print(dp[N][C])
### BUGGY CODE ###

N, M = map(int, input().split())
path = [[] for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    path[a-1] += [b-1]
    path[b-1] += [a-1]
visited = [1] + [0] * (N-1)

u = 0
ans = 1
curr = 1
next_u = [u]
while True:
    if len(next_u) == 0:
        ans = max(ans, curr)
        curr = 1
        for i in range(N):
            if visited[i] == 0 and len(path[i])!= 0:
                visited[i] = 1
                next_u = path[i]
                break
        else:
            break
    u = next_u.pop()
    for v in path[u]:
        if visited[v] == 1:
            continue 
        visited[v] = 1
        next_u += [v]
        curr += 1

print(ans)

### FIXED CODE ###

N, M = map(int, input().split())
path = [set() for i in range(N)]
for i in range(M):
    a, b = map(int, input().split())
    path[a-1].add(b-1)
    path[b-1].add(a-1)
visited = [0] * N

ans = 1
for u in range(N):
    if visited[u] == 1:
        continue
    curr = 1
    visited[u] = 1
    next_u = path[u]
    while next_u:
        v = next_u.pop()
        if visited[v] == 1:
            continue
        visited[v] = 1
        curr += 1
        for w in path[v]:
            if visited[w] == 0:
                next_u.add(w)
    ans = max(ans, curr)

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

import heapq
INF = float('inf')
yen = 10**15
def pcc(src, adj):
	pq = [(0,src)]
	heapq.heapify(pq)
	dist = [INF]*(n+1)
	dist[src] = 0
	while pq:
		d,u = heapq.heappop(pq)
		if d>dist[u]:continue
		for w, v in adj[u]:
			if dist[v] > dist[u] + w:
				dist[v] = dist[u] + w
				heapq.heappush(pq, (dist[v], v))
	return dist

n,m,s,t = (int(i) for i in input().split())
adjs = [[] for _ in range(n+1)]
adjt = [[] for _ in range(n+1)]
for _ in range(m):
	u,v,a,b = (int(i) for i in input().split())
	adjs[u].append([a,v])
	adjs[v].append([a,u])
	adjt[u].append([b,v])
	adjt[v].append([b,u])

dist_s = pcc(s,adjs)
dist_t = pcc(t,adjt)
ans = [0]*(n)
ans[n-1] = yen -dist_s[n] - dist_t[n]
for i in range(n-2,-1,-1):
	ans[i] = max(ans[i+1], yen - dist_s[i+1] - dist_t[i+1])
print(*ans, sep = '\n')


### FIXED CODE ###

import heapq
def dijkstra(s, neighbor):
	dist = [float('inf')] * N
	dist[s] = 0
	que = [(0, s)]
	heapq.heapify(que)
	while que:
		d, v = heapq.heappop(que)
		if d > dist[v]:
			continue
		for u, l in neighbor[v]:
			tmp_d = d + l
			if tmp_d < dist[u]:
				dist[u] = tmp_d
				heapq.heappush(que, (tmp_d, u))
	return dist
 
N, M, s, t = map(int, input().split())
yen = [[] for _ in range(N)]
snuuk = [[] for _ in range(N)]
for _ in range(M):
	u, v, a, b = map(int, input().split())
	yen[u-1].append((v-1, a))
	yen[v-1].append((u-1, a))
	snuuk[u-1].append((v-1, b))
	snuuk[v-1].append((u-1, b))
 
dist_s = dijkstra(s-1, yen)
dist_t = dijkstra(t-1, snuuk)
ans = [-1] * N
tmp = float('inf')
for i in range(N-1, -1, -1):
	if dist_s[i] + dist_t[i] < tmp:
		tmp = dist_s[i] + dist_t[i]
	ans[i] = 10 ** 15 - tmp
print(*ans, sep='\n')
### BUGGY CODE ###

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

for i in range(A,B+1):
  if i - K < A or i + K > B:
    print(i)

### FIXED CODE ###

A,B,K = map(int, input().split())
if B-A > 2 * K:
  [print(i) for i in range(A,A+K)]
  [print(i) for i in range(B+1-K,B+1)]
else:
  [print(i) for i in range(A,B+1) if i - K < A or i + K > B]
### BUGGY CODE ###

k = int(input())
cand = [1, 2, 3, 4, 5, 6, 7, 8, 9]
temp = []
for i in range(k):
    t = cand.pop(0)
    temp.append(t)
    if t % 10 != 0:
        cand.append(t*10+(t%10-1))
    cand.append(t*10+(t%10))
    if t % 10 != 9:
        cand.append(t*10+(t%10+1))
print(temp[k-1])

### FIXED CODE ###

from collections import deque

k = int(input())
cand = deque([1, 2, 3, 4, 5, 6, 7, 8, 9])
temp = []
for i in range(k):
    t = cand.popleft()
    temp.append(t)
    if t % 10 != 0:
        cand.append(t*10+(t%10-1))
    cand.append(t*10+(t%10))
    if t % 10 != 9:
        cand.append(t*10+(t%10+1))
print(temp[k-1])
### BUGGY CODE ###

import numpy as np

N = int(input())
A = [int(i) for i in input().split()]


def solve(a):
    ar = np.array(a)
    u= np.unique(ar)
    c = 0
    for j in u:
      v = len(np.where(a==j)[0])
      c += int(v*(v-1)/2)
    print(c)

for k in range(N):
    p_A = A[:k] + A[k+1:]
    solve(p_A)

### FIXED CODE ###

import collections

N = int(input())
A = [int(i) for i in input().split()]

u = collections.Counter(A)
sum = 0
for j, c in u.items():
    sum += int(c * (c - 1) / 2)

s = ""
for k in A:
    s += str(sum - u[k] + 1) + "\n"
print(s)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
# abc 127 d
# input
n, m = map(int, input().split())
a = sorted(list(map(int, input().split())))
upd = []
for i in range(m):
    s, l = map(int, input().split())
    for j in range(s):
        upd.append(l)
upd.sort(reverse=True)

# output
f = len(a)
o = 0
c = len(upd)
if f > c:
    for i in range(c):
        o += max(upd[c-1-i], a[c-1-i])
#        print(o)
    print(o+sum(a[c:]))
else:
    for i in range(f):
        o += max(upd[i], a[i])
#        print(o)
    print(o)

### FIXED CODE ###

# -*- coding: utf-8 -*-
# abc 127 d
from operator import itemgetter
# input
n, m = map(int, input().split())
a = list(map(int, input().split()))
a.sort()
upd = []
for i in range(m):
    upd.append(list(map(int, input().split())))
upd.sort(key=itemgetter(1), reverse=True)
# print(upd)
# output
f = len(a)
p = 0
for t in upd:
    for i in range(p, p+t[0]):
        if p < f:
            if a[p] < t[1]:
                a[p] = t[1]
            else:
                break
        else:
            break
        p += 1
print(sum(a))
### BUGGY CODE ###

from collections import deque
import math
import sys

N_MAX = 200000 + 5
sys.setrecursionlimit(N_MAX)

H, W, K = map(int, sys.stdin.readline().split())
x1, y1, x2, y2 = map(int, sys.stdin.readline().split())
INF = 10**6 * K

dp = [[INF for _ in range(W+2)] for _ in range(H+2)]

dp[0] = [-1]*(W+2)
dp[H+1] = [-1]*(W+2)
for h in range(1,H+1):
    s = sys.stdin.readline()
    dp[h][0] = -1
    dp[h][W+1] = -1
    for w in range(1,W+1):
        if s[w-1] == "@":
            dp[h][w] = -1

### BFS ###

# ステップ方向
D = [0, 1, 2, 3]  # direction
Y = [1, 0, -1, 0]
X = [0, 1, 0, -1]

def bfs(x1, y1):
    
    q = deque()
    q.append((x1, y1))

    while q:
        # print(q)
        x0, y0 = q.popleft()

        for x, y in zip(X, Y):

            for i in range(1,K+1):

                # print(y0,y,x0,x,d, (y0+y,x0+x,d), end=" : ")
                dp_c = dp[x0][y0]  # 現在のdp値
                n_x, n_y = x0+x*i, y0+y*i

                # print(dp_c, (n_x,n_y), end=" : ")

                if dp[n_x][n_y] == -1:
                    # print("@")
                    break

                if dp[n_x][n_y] <= dp_c + 1:
                    continue

                dp[n_x][n_y] = dp_c + 1
                q.append((n_x, n_y))


# スタート地点を 0 にする
dp[x1][y1] = 0

bfs(x1,y1)

# print(dp)
# print(x2-1,y2-1)

if dp[x2][y2] == INF:
    print(-1)
else:
    print(dp[x2][y2])

### FIXED CODE ###

#!/usr/bin python3
# -*- coding: utf-8 -*-
 
H, W, K = map(int,input().split())
sth, stw, glh, glw = map(int,input().split())
sth, stw = sth-1, stw-1
glh, glw = glh-1, glw-1
 
INF = -1
Gmap = [list(input()) for _ in range(H)]
Seen = [[INF]*W for _ in range(H)]
direc = {(1,0), (-1,0), (0,1), (0,-1)}
 
from collections import deque
 
def bfs(sth, stw, glh, glw):
    next_q = deque([])
    next_q.append((sth,stw,0))
    Seen[sth][stw] = 0
 
    while len(next_q)!=0:
        #キュー取り出し(先頭)
        h, w, c = next_q.popleft()
        for dh, dw in direc:
            for sk in range(1,K+1):
                hs, ws = h + dh*sk, w + dw*sk
                if not (0<=hs<H and 0<=ws<W):
                    break
                if Gmap[hs][ws]=='@':
                    break
                if Seen[hs][ws]==INF:
                    next_q.append((hs,ws,c+1))
                    Seen[hs][ws] = c + 1
                elif Seen[hs][ws]<=c:
                    break
                if hs==glh and ws==glw:
                    return c + 1
    return -1

def main():
    ret = bfs(sth, stw, glh, glw)
    print(ret)

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

from sys import stdin
import numpy as np
def main():
    #入力
    readline=stdin.readline
    mod=10**9+7
    s=readline().strip()
    n=len(s)

    dp=np.zeros(13,dtype=np.int64)
    tmp1=np.arange(10,dtype=np.int64)
    keta=10
    for i in range(n-1,-1,-1):
        if i==n-1:
            if s[i]=="?":
                dp[0:10]=1
            else:
                dp[int(s[i])]=1
        else:
            if s[i]=="?":
                tmp2=(keta*tmp1)%13
            else:
                tmp2=(keta*int(s[i]))%13
            nex=np.zeros(13,dtype=np.int64)
            for j in range(13):
                nex[(tmp2+j)%13]+=dp[j]
            nex%=mod
            dp=nex
            keta*=10
            keta%=13

    print(dp[5])

if __name__=="__main__":
    main()

### FIXED CODE ###

#import numpy as np
def main():
    S=input()
    #dp=np.zeros((len(S)+1,13),dtype=int)
    dp=[[0]*13 for _ in range(len(S)+1)]
    dp[0][0]=1
    mod=10**9+7
    """
    for i in range(1,len(S)+1):
        for a in range(13):
            if S[i-1]=="?":
                if a*10%13<(a*10+10)%13:
                    dp[i][a*10%13:(a*10+10)%13]+=dp[i-1][a]
                    dp[i][a*10%13:(a*10+10)%13]%=mod
                else:
                    dp[i][a*10%13:]+=dp[i-1][a]
                    dp[i][a*10%13:]%=mod
                    dp[i][:(a*10+10)%13]+=dp[i-1][a]
                    dp[i][:(a*10+10)%13]%=mod
            else:
                dp[i][(a*10+int(S[i-1]))%13]+=dp[i-1][a]
                dp[i][(a*10+int(S[i-1]))%13]%=mod
    print(dp[len(S)][5])
"""
    for i in range(1,len(S)+1):
        for a in range(13):
            if S[i-1]=="?":
                for n in range(10):
                    dp[i][(a*10+n)%13]+=dp[i-1][a]
                    dp[i][(a*10+n)%13]%=mod
            else:
                dp[i][(a*10+int(S[i-1]))%13]+=dp[i-1][a]
                dp[i][(a*10+int(S[i-1]))%13]%=mod
    print(dp[len(S)][5])
if __name__=="__main__":
    main()
### BUGGY CODE ###

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

g = [[] for _ in range(N)]

A, B = [0]*M, [0]*M
for i in range(M):
    A[i], B[i] = map(int, input().split())
    g[A[i]-1].append(B[i]-1)
    g[B[i]-1].append(A[i]-1)

ans_list = [-1] * N

queue = [0]
seen = []

while queue:
    qi = queue.pop(0)
    # qi から 1 遠い頂点が gi
    for gi in g[qi]:
        if gi not in seen:
            queue.append(gi)
            if ans_list[gi] == -1:
                ans_list[gi] = qi
                seen.append(gi)

print("Yes")
for ans in ans_list[1:]:
    print(ans+1)  # 1-index に直す


### FIXED CODE ###

def main():
    N, M = map(int, input().split())
    g = [[] for _ in range(N)]

    A, B = [0]*M, [0]*M
    for i in range(M):
        A[i], B[i] = map(int, input().split())
        g[A[i]-1].append(B[i]-1)
        g[B[i]-1].append(A[i]-1)

    ans_list = [-1] * N

    queue = [0]
    seen = [False]*N

    while queue:
        qi = queue.pop(0)
        # qi から 1 遠い頂点が gi
        for gi in g[qi]:
            if seen[gi] == False:
                queue.append(gi)
                if ans_list[gi] == -1:
                    ans_list[gi] = qi
                    seen[gi] = True

    print("Yes")
    for ans in ans_list[1:]:
        print(ans+1)  # 1-index に直す

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

A,B,C,D = map(int,input().split(' '))

countsum = 0
countC = 0
countD = 0
countC_D = 0
for i in range(A,B+1,1):
  countsum += 1
  if i % C == 0:
    countC += 1
  if i % D == 0:
    countD += 1
  if i % C == 0 and i % D == 0:
    countC_D += 1

print(countsum-countC-countD+countC_D)

### FIXED CODE ###

import fractions as frac
A,B,C,D = map(int,input().split(' '))

countC = (B // C) - (A // C)
countD = (B // D) - (A // D)
def lcm(x, y):
    return (x * y) // frac.gcd(x, y)
lcmCD = lcm(C, D)

countlcm = (B // lcmCD) - (A // lcmCD) 

num = B - A + 1
if A % C == 0:
  countC += 1
if A % D == 0:
  countD += 1
if A % lcmCD == 0:
  countlcm += 1

print(num - countC - countD + countlcm)
### BUGGY CODE ###

# WA出そう
INF = 10**18


def main():
    import sys
    input = sys.stdin.readline
    from collections import defaultdict
    N = int(input())
    T = [[int(i) for i in input().split()] for j in range(N)]
    pow_2 = [pow(2, i) for i in range(N+1)]
    X_dist = [[0]*N for _ in range(1 << N)]
    Y_dist = [[0]*N for _ in range(1 << N)]

    # bitという道路群を建設したときの，各集落の評価距離
    for bit in range(1 << N):
        cur_x = [0]
        cur_y = [0]
        for i in range(N):
            if bit & (1 << i):
                cur_x.append(T[i][0])
                cur_y.append(T[i][1])
        for i, (x, y, p) in enumerate(T):
            X_dist[bit][i] = p*min(abs(cx - x) for cx in cur_x)
            Y_dist[bit][i] = p*min(abs(cy - y) for cy in cur_y)

    answer = [INF] * (N+1)
    for bit in range(3**15):
        x_bit = 0
        y_bit = 0
        cnt = 0
        for i in range(N):
            b = bit % 3
            bit //= 3
            if b == 2:
                # x = a
                x_bit += pow_2[i]
                cnt += 1
            elif b == 1:
                # y = a
                y_bit += pow_2[i]
                cnt += 1
        # 距離の評価
        cur_d = 0
        for i in range(N):
            cur_d += min(X_dist[x_bit][i], Y_dist[y_bit][i])
        answer[cnt] = min(answer[cnt], cur_d)

    for ans in answer:
        print(ans)


if __name__ == '__main__':
    main()


### FIXED CODE ###

# writer解(c++)を写経した．answerのfor文のところ何やってるかさっぱりわかりませんが…
# https://atcoder.jp/contests/m-solutions2020/submissions/15122924
import sys
input = sys.stdin.readline
INF = 10**13


def main():
    N = int(input())
    X = []
    Y = []
    P = []
    for _ in range(N):
        a, b, c = (int(i) for i in input().split())
        X.append(a)
        Y.append(b)
        P.append(c)
    X_dist = [[0]*N for _ in range(1 << N)]
    Y_dist = [[0]*N for _ in range(1 << N)]

    # bitという道路群を建設したときの，各集落の評価距離
    # bit 001001 とかの1が立っている集落に道を作る
    for bit in range(1 << N):
        for i in range(N):
            X_dist[bit][i] = P[i]*abs(X[i])
            Y_dist[bit][i] = P[i]*abs(Y[i])
            for k in range(N):
                if bit & (1 << k):
                    X_dist[bit][i] = \
                        min(X_dist[bit][i], P[i]*abs(X[i] - X[k]))
                    Y_dist[bit][i] = \
                        min(Y_dist[bit][i], P[i]*abs(Y[i] - Y[k]))

    # これはなに？
    answer = [INF] * (N+1)
    for i in range(1 << N):
        cnt = 0
        for j in range(N):
            if (i >> j) & 1:
                cnt += 1
        j = i
        while j >= 0:
            j &= i
            cost = 0
            for k in range(N):
                if not((i >> k) & 1):
                    cost += min(X_dist[j][k], Y_dist[i - j][k])
            answer[cnt] = min(answer[cnt], cost)
            j -= 1

    for ans in answer:
        print(ans)


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

def dfs(i, j, s):
    if j > 3:
        return
    if j == 3 and s == x:
        ans.append(1)

    for k in range(1, i):
        dfs(k, j + 1, s + k)

while True:
    ans = []
    n, x = map(int, input().split())
    if n == x == 0:
        break

    for i in range(1, n + 1):
        dfs(i, 1, i)

    print(sum(ans))


### FIXED CODE ###

def calc(n, x):
    result = 0
    for i in range(3, n + 1):
        for j in range(2, i):
            if i + j < x < i + 2 * j:
                result += 1
    return str(result)

ans = []
while True:
    n, x = map(int, input().split())
    if n == x == 0:
        break
    ans.append(calc(n, x))

print("\n".join(ans))
### BUGGY CODE ###

n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
dp = [[[0]*(x_max*n+1) for k in range(n+1)] for i in range(n+1)]
ans = 0
dp[0][0][0] = 1
for i in range(n):
    for j in range(i+2):
        for k in range(x_max*n+1):
            if k>= x[i]:
                dp[i+1][j][k] = dp[i][j-1][k-x[i]] + dp[i][j][k]
            else:
                dp[i+1][j][k] = dp[i][j][k]
for k in range(x_max*n+1):
    for j in range(1,n+1):
        if a*j == k:
            ans += dp[n][j][k]
print(ans)

### FIXED CODE ###

n, a = map(int, input().split())
x = list(map(int, input().split()))
x_max = max(x)
dp = [[[0]*(x_max*n+1) for k in range(n+1)] for i in range(n+1)]
ans = 0
dp[0][0][0] = 1
for i in range(n):
    for j in range(i+2):
        for k in range(x_max*n+1):
            if k>= x[i]:
                dp[i+1][j][k] = dp[i][j-1][k-x[i]] + dp[i][j][k]
            else:
                dp[i+1][j][k] = dp[i][j][k]
            
for k in range(x_max*n+1):
    for j in range(1,n+1):
        if a*j == k:
            ans += dp[n][j][k]
print(ans)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    ans = []
    for _ in range(N):
        tmp = inputInt()
        if tmp in ans:
            ans.remove(tmp)
        else:
            ans.append(tmp)
        
    print(len(ans))
        
            	
if __name__ == "__main__":
	main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import sys
import copy
import collections
from bisect import bisect_left
from bisect import bisect_right
from collections import defaultdict
from heapq import heappop, heappush
import math

# NO, PAY-PAY
#import numpy as np
#import statistics
#from statistics import mean, median,variance,stdev

def inputInt(): return int(input())
def inputMap(): return map(int, input().split())
def inputList(): return list(map(int, input().split()))
 
def main():
    N = inputInt()
    ans = {}
    for _ in range(N):
        tmp = inputInt()
        if tmp in ans:
            ans[tmp] += 1
        else:
            ans[tmp] = 1
        
    o = 0
    for v in ans.values():
        if v % 2 == 1:
            o += 1
    print(o)
        
            	
if __name__ == "__main__":
	main()