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

n = int(input())
a = [int(input()) for i in range(n)]

l = []
count = 0
for i in range(n):
    if a[i] in l:
        l.remove(a[i])
        count -= 1
    else:
        l.append(a[i])
        count += 1
print(count)

### FIXED CODE ###

n = int(input())
a = [int(input()) for i in range(n)]

l = sorted(a)
same = 1
count = 0
for i in range(1, n):
    if l[i] == l[i - 1]:
        same += 1
        continue
    if same % 2 == 1:
        count += 1
    same = 1
if same % 2 == 1:
    count += 1
print(count)
### BUGGY CODE ###

import numpy as np

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

def imos(A):
    B=np.zeros_like(A)
    for i,x in enumerate(A):
        a=max(0,i-x)
        b=min(i+x,N-1)
        B[a]+=1
        if b+1<=N-1:
            B[b+1]-=1
    B=np.cumsum(B)
    return B

for i in range(K):
    if i>=50:
        break
    A=imos(A)
print(*A)

### FIXED CODE ###

import numpy as np
from numba import jit
N,K=map(int,input().split())
A=list(map(int,input().split()))

@jit
def imos(A):
    B=np.zeros_like(A)
    for i,x in enumerate(A):
        a=max(0,i-x)
        b=min(i+x,N-1)
        B[a]+=1
        if b+1<=N-1:
            B[b+1]-=1
    B=np.cumsum(B)
    return B

for i in range(K):
    if i>=50:
        break
    A=imos(A)
print(*A)
### BUGGY CODE ###

def to_dict(text):
    d = {}
    for c in text:
        d[c] = d.get(c, 0) + 1
    return d


n = int(input())
combination_count = 0
s = []
for _ in range(n):
    si = to_dict(input())
    combination_count += sum(1 for old_si in s if old_si == si)
    s.append(si)

print(combination_count)


### FIXED CODE ###

import collections

n = int(input())
counter = collections.Counter(str(sorted(input())) for _ in range(n))
combination_count = sum((v - 1) * v // 2 for v in counter.values())

print(combination_count)
### BUGGY CODE ###

N = int(input())
S = input()

Rs = 0
Gs = 0
Bs = 0
for il in S:
    if il == 'R':
        Rs += 1
    if il == 'G':
        Gs += 1
    if il == 'B':
        Bs += 1
num = 0
for i in range(N):
    for step in range(1, N):
        j = i + step
        k = i + 2*step
        if k > N - 1:
            continue
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            num += 1
print(Rs*Gs*Bs - num)


### FIXED CODE ###

N = int(input())
S = input()

Rs = 0
Gs = 0
Bs = 0
for il in S:
    if il == 'R':
        Rs += 1
    if il == 'G':
        Gs += 1
    if il == 'B':
        Bs += 1
num = 0
for i in range(N):
    for step in range(1, N):
        j = i + step
        k = i + 2*step
        if k > N - 1:
            break
        if S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            num += 1
print(Rs*Gs*Bs - num)
### BUGGY CODE ###

import numpy as np
import collections

def main():
    S = str(input())
    n = len(S)

    T = [-1 for i in range(n+1)]
    T[-1] = 0
    # for i in range(n):
    #     #print(S[i:])
    #     T[i] = int(S[i:]) % 2019
    # print(T)
    for i in reversed(range(n)):
        T[i] = (int(S[i])*10**(n-1 -i) + T[i+1]) % 2019

    #print(T)
    C = collections.Counter(T)
    #print(C) # dict 型のサブクラス，Counter
    ans = 0
    for value, count in C.items():
        ans += int(count*(count-1)/2)
    print(ans)

if __name__ == "__main__":
    main()

### FIXED CODE ###

import numpy as np
import collections

def main():
    S = str(input())
    n = len(S)

    T = [-1 for i in range(n+1)]
    T[-1] = 0
    # for i in range(n):
    #     #print(S[i:])
    #     T[i] = int(S[i:]) % 2019
    # print(T)
    b = [1 for i in range(n)]
    for i in reversed(range(n-1)):
        b[i] = b[i+1]*10 % 2019
    #print(b)

    # for i in reversed(range(n)):
    #     T[i] = (int(S[i])*10**(n-1 -i) + T[i+1]) % 2019
    # print(T)

    for i in reversed(range(n)):
        T[i] = (b[i]*int(S[i]) + T[i+1]) % 2019
    #print(T)


    C = collections.Counter(T)
    #print(C) # dict 型のサブクラス，Counter
    ans = 0
    for value, count in C.items():
        ans += int(count*(count-1)/2)
    print(ans)

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

n,m=map(int,input().split())
a=[]
for i in range(m):
  a.append(int(input()))
b=[0 for x in range(n+1)]
b[0]=1
for i in range(1,n+1):
  if i in a:
    continue
  x=b[i-1]
  if i>1:x+=b[i-2]
  b[i]=x
print(b[n]%(10**9+7))

### FIXED CODE ###

n,m=map(int,input().split())
a=[]
a = set(int(input()) for _ in range(m))
#for i in range(m):
#  a.append(int(input()))
b=[0 for x in range(n+1)]
b[0]=1
for i in range(1,n+1):
  if i in a:
    continue
  x=b[i-1]
  if i>1:x+=b[i-2]
  b[i]=x
print(b[n]%(10**9+7))
### BUGGY CODE ###

N=int(input())
A=[int(x) for x in input().split()]
A_s=set(A)
for i in range(N):
    Com=0
    A_k=A.copy()
    A_k[i]=""
    A_k_s=set(A_k)
    for k in A_k_s:
        x=A_k.count(k)
        Com+=int(x*(x-1)/2)
    print(Com)

### FIXED CODE ###

from collections import Counter

N=int(input())
A=[int(x) for x in input().split()]
Com=0

A_C=Counter(A)

for name,x in A_C.items():
    Com+=int(x*(x-1)/2)
    
for i in range(N):
    y=A_C[A[i]]
    print(Com-y+1)
### BUGGY CODE ###

n, m = map(int, input().split())
ps = [float('inf')] * 2**n
for _ in range(m):
    a, b = map(int, input().split())
    s = sum([2**(i - 1) for i in map(int, input().split())])
    ps[s] = min(ps[s], a)
    for i in range(2**n):
        if i == s:
            ps[i] = min(ps[i], ps[s])
        elif i & s == i:
            ps[i] = min(ps[i], ps[s])
        elif i & s == s:
            ps[s] = min(ps[i], ps[s])
        else:
            ps[i | s] = min(ps[i | s], ps[i] + ps[s])
if ps[2**n - 1] == float('inf'):
    print(-1)
else:
    print(ps[2**n - 1])

### FIXED CODE ###

n, m = map(int, input().split())
ps = [float('inf')] * 2**n
for _ in range(m):
    a, b = map(int, input().split())
    s = sum([2**(i - 1) for i in map(int, input().split())])
    ps[s] = min(ps[s], a)
    for i in range(2**n):
        if i == s:
            ps[i] = min(ps[i], ps[s])
        elif i & s == i:
            ps[i] = min(ps[i], ps[s])
        elif i & s == s:
            ps[s] = min(ps[i], ps[s])
        else:
            ps[i | s] = min(ps[i | s], ps[i] + ps[s])
if ps[2**n - 1] == float('inf'):
    print(-1)
else:
    print(ps[2**n - 1])
### BUGGY CODE ###

class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x == y:
      return
    if self.parents[x] > self.parents[y]:
      x, y = y, x
    self.parents[x] += self.parents[y]
    self.parents[y] = x

  def size(self, x):
    return -self.parents[self.find(x)]

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()}

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

uf = UnionFind(N)

for _ in range(M):
  x, y = map(lambda x: int(x)-1, input().split())
  uf.union(x, y)

D = uf.all_group_members()

ans = 0

for L in D.values():
  check = set(L)
  for i in L:
    if p[i]-1 in L:
      ans += 1

print(ans)

### FIXED CODE ###

class UnionFind():
  def __init__(self, n):
    self.n = n
    self.parents = [-1] * n

  def find(self, x):
    if self.parents[x] < 0:
      return x
    else:
      self.parents[x] = self.find(self.parents[x])
      return self.parents[x]

  def union(self, x, y):
    x = self.find(x)
    y = self.find(y)
    if x == y:
      return
    if self.parents[x] > self.parents[y]:
      x, y = y, x
    self.parents[x] += self.parents[y]
    self.parents[y] = x

  def size(self, x):
    return -self.parents[self.find(x)]

  def same(self, x, y):
    return self.find(x) == self.find(y)

  def members(self, x):
    root = self.find(x)
    return [i for i in range(self.n) if self.find(i) == root]

  def roots(self):
    return [i for i, x in enumerate(self.parents) if x < 0]

  def group_count(self):
    return len(self.roots())

  def all_group_members(self):
    return {r: self.members(r) for r in self.roots()}

  def __str__(self):
    return '\n'.join('{}: {}'.format(r, self.members(r)) for r in self.roots())

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

uf = UnionFind(N)

for _ in range(M):
  x, y = map(lambda x: int(x)-1, input().split())
  uf.union(x, y)

ans = 0

for i, p in enumerate(P):
  if uf.same(i, p-1):
    ans += 1

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

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

bad=[]
for i in range(M):
	A,B=list(map(int,input().split()))
	if (H[A-1]<=H[B-1])and(A-1 not in bad): bad.append(A-1)
	if (H[A-1]>=H[B-1])and(B-1 not in bad): bad.append(B-1)

print(N-len(bad))

### FIXED CODE ###

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

bad=set()
c=0
for i in range(M):
	A,B=list(map(int,input().split()))
	if (H[A-1]<=H[B-1])and(A-1 not in bad):
		bad.add(A-1)
	if (H[A-1]>=H[B-1])and(B-1 not in bad):
		bad.add(B-1)

print(N-len(bad))
### BUGGY CODE ###

N=int(input())
S=input()
PIN=[]
ans=0
#パスコード000~999まで、Sに含まれるか判定
for i in range(N):
    Ein=S[i]
    for j in range(i+1,N):
        Zwei=S[j]
        for k in range(j+1,N):
            Drei=S[k]
            cand=Ein+Zwei+Drei
            if cand in PIN:
                continue
            else:
                PIN.append(cand)
    
print(len(PIN))

### FIXED CODE ###

N=int(input())
S=input()
PIN=[]
b1=[]
for i in range(N-2):
    Ein=S[i]
    b2=[]
    if Ein in b1:
        continue
    else:
        b1.append(Ein)
    for j in range(i+1,N-1):
        b3=[]
        Zwei=S[j]
        if Zwei in b2:
            continue
        else:
            b2.append(Zwei)
        for k in range(j+1,N):
            Drei=S[k]
            if Drei in b3:
                continue
            else:
                b3.append(Drei)
                cand=Ein+Zwei+Drei
            if cand in PIN:
                continue
            else:
                PIN.append(cand)
print(len(PIN))
### BUGGY CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input())
result = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            add = gcd(i, j, k)
            result += add

print(result)


### FIXED CODE ###

import math
from functools import reduce

def gcd(*numbers):
    return reduce(math.gcd, numbers)


K = int(input())
result = 0

for i in range(1, K+1):
    for j in range(1, K+1):
        for k in range(1, K+1):
            add = gcd(i, j, k)
            result += add

print(result)
### BUGGY CODE ###

n,C=map(int,input().split())
N=10**5+1
INF = 2**31-1
 
LV = N.bit_length()
N0 = 2**LV
data = [0]*(2*N0)
lazy = [0]*(2*N0)
 
def gindex(l, r):
    L = l + N0; R = r + N0
    lm = (L // (L & -L)) >> 1
    rm = (R // (R & -R)) >> 1
    while L < R:
        if R <= rm:
            yield R
        if L <= lm:
            yield L
        L >>= 1; R >>= 1
    while L:
        yield L
        L >>= 1
 
def propagates(*ids):
    for i in reversed(ids):
        v = lazy[i-1]
        if not v:
            continue
        lazy[2*i-1] += v; lazy[2*i] += v
        data[2*i-1] += v; data[2*i] += v
        lazy[i-1] = 0
 
def update(l, r, x):
    L = N0 + l; R = N0 + r
    while L < R:
        if R & 1:
            R -= 1
            lazy[R-1] += x; data[R-1] += x
        if L & 1:
            lazy[L-1] += x; data[L-1] += x
            L += 1
        L >>= 1; R >>= 1
    for i in gindex(l, r):
        data[i-1] = min(data[2*i-1], data[2*i]) + lazy[i-1]
 
def query(l, r):
    propagates(*gindex(l, r))
    L = N0 + l; R = N0 + r
 
    s = INF
    while L < R:
        if R & 1:
            R -= 1
            s = min(s, data[R-1])
        if L & 1:
            s = min(s, data[L-1])
            L += 1
        L >>= 1; R >>= 1
    return s

a=[[0 for i in range(N)]for i in range(C)]

for i in range(n):
    s,t,c=map(int,input().split())
    recs,rect=a[c-1][s],a[c-1][t]
    if recs==0 and rect==0: update(s-1,t,-1)
    elif recs==0 and rect==1: update(s-1,t-1,-1)
    elif recs==1 and rect==0: update(s,t,-1)
    elif recs==1 and rect==1 and s<t-1: update(s,t-1,-1)
    a[c-1][s],a[c-1][t]=1,1
print(-query(0,N+1))

### FIXED CODE ###

import sys
import math
from itertools import accumulate as acc

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


a=[[0 for i in range(10**5+1)] for i in range(C+1)]

rec=[0 for i in range(10**5+1)]

for i in range(N):
    s,t,c=map(int,input().split())
    recs,rect=a[c][s],a[c][t]
    if recs==0 and rect==0:
        rec[s-1]+=1
        rec[t]-=1
    elif recs==0 and rect==1:
        rec[s-1]+=1
        rec[t-1]-=1
    elif recs==1 and rect==0:
        rec[s]+=1
        rec[t]-=1
    elif recs==1 and rect==1:
        rec[s]+=1
        rec[t-1]-=1

    a[c][s],a[c][t]=1,1

tmp=0
ans=0
for i in range(10**5):
    tmp+=rec[i]
    ans=max(tmp,ans)
print(ans)
### BUGGY CODE ###

N,Q=map(int,input().split())
S=input()
L=list()
for i in range(N-1):
  if S[i]=="A" and S[i+1]=="C":
    L.append(i)
for i in range(Q):
  n,m=map(int,input().split())
  k= sum(1 for x in L if n-1<=x<m-1)
  print(k)

### FIXED CODE ###

N,Q=map(int,input().split())
S=input()
L=[0]*N
for i in range(1,N):
  if S[i-1]=="A" and S[i]=="C":
    L[i]=L[i-1]+1
  else:
    L[i]=L[i-1]
for i in range(Q):
  a,b=map(int,input().split())
  print(L[b-1]-L[a-1])
### BUGGY CODE ###

import collections

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

ac = collections.Counter(a)
ans = 0

for i in range(a[0],a[-1]+1):
    if ac[i] < i:
        ans += ac[i]
    else:
        ans += ac[i] - i

print(ans)

### FIXED CODE ###

import collections

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

ac = collections.Counter(a)
ans = 0

for i in s:
    if ac[i] < i:
        ans += ac[i]
    else:
        ans += ac[i] - i

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

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7

H, W = MAP()
a = ["#"*(W+2)]+["#"+input()+"#" for _ in range(H)] + ["#"*(W+2)]

dx = [1, 0]
dy = [0, 1]

comb = [[0]*(W+2) for _ in range(H+2)]
comb[1][1] = 1
q = deque()
q.append((1, 1))
while q:
    i, j = q.popleft()
    for k in range(2):
        y = i+dy[k]
        x = j+dx[k]
        if a[y][x] != "#":
            comb[y][x] = (comb[y][x] + comb[i][j])%mod
            if (y, x) not in q:
                q.append((y, x))
print(comb[H][W])


### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product, islice
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
def ZIP(n): return zip(*(MAP() for _ in range(n)))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10**9 + 7

H, W = MAP()
a = ["#"*(W+2)]+["#"+input()+"#" for _ in range(H)] + ["#"*(W+2)]

dx = [1, 0]
dy = [0, 1]

comb = [[0]*(W+2) for _ in range(H+2)]
comb[1][1] = 1
q = deque()
q.append((1, 1))
while q:
    i, j = q.popleft()
    for k in range(2):
        y = i+dy[k]
        x = j+dx[k]
        if a[y][x] != "#":
            if comb[y][x] == 0:
                q.append((y, x))
            comb[y][x] = (comb[y][x] + comb[i][j])%mod

print(comb[H][W])
### BUGGY CODE ###

N = int(input())
S = input()

num_r, num_g = S.count('R'), S.count('G')
num_b = N - num_r - num_g
max_ans = num_r * num_g * num_b
count_not_ans = 0
S = list(S)

for i in range(N-2):
    for j in range(i+1, N-1):
        k = 2 * j - i
        if (0 <= k <= N-1) and S[i] != S[j] and S[j] != S[k] and S[k] != S[i]:
            count_not_ans += 1

print(max_ans - count_not_ans)


### FIXED CODE ###

N = int(input())
S = input()

num_r, num_g = S.count('R'), S.count('G')
num_b = N - num_r - num_g
max_ans = num_r * num_g * num_b
count_not_ans = 0
S = list(S)

for i in range(N):
    for j in range(i+1, N):
        k = 2 * j - i
        if (0 <= k <= N-1) and len(set([S[i], S[j], S[k]])) == 3:
            count_not_ans += 1

print(max_ans - count_not_ans)
### BUGGY CODE ###

from collections import deque


dir_y = [1, 0, -1, 0]
dir_x = [0, 1, 0, -1]
def paint():
    for _ in range(len(que)):
        y, x = que.popleft()
        for i in range(4):
            next_y = y + dir_y[i]
            next_x = x + dir_x[i]
            if 0 <= next_y < H and 0 <= next_x < W and not has_visited[next_y][next_x]:
                has_visited[next_y][next_x] = True
                que.append((next_y, next_x))


H, W = map(int, input().split())
canvas = []
has_visited = [[False]*W for _ in range(H)]
que = deque()
for y in range(H):
    canvas.append(list(input()))
    for x in range(W):
        if canvas[y][x] == "#":
            que.append((y, x))
            has_visited[y][x] = True

count = 0
while len(que) > 0:
    paint()
    count += 1

print(count-1)


### FIXED CODE ###

H, W = map(int, input().split())

has_visited = [[True]*(W+2)]
has_visited += [[True] + [m == "#" for m in input().rstrip()] + [True] for _ in range(H)]
has_visited += [[True]*(W+2)]

search_que = []
for y in range(1, H+1):
    for x in range(1, W+1):
        if has_visited[y][x]:
            search_que.append((y, x))

count = -1
while search_que:
    count += 1
    next_que = []
    for y, x in search_que:
        if not has_visited[y+1][x]:
            has_visited[y+1][x] = True
            next_que.append((y+1, x))
        if not has_visited[y-1][x]:
            has_visited[y-1][x] = True
            next_que.append((y-1, x))
        if not has_visited[y][x+1]:
            has_visited[y][x+1] = True
            next_que.append((y, x+1))
        if not has_visited[y][x-1]:
            has_visited[y][x-1] = True
            next_que.append((y, x-1))
    search_que = next_que

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

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

ans = 1
for i in a:
  ans = ans * i
  
if ans > 10**18:
  print(-1)
else:
  print(ans)

### FIXED CODE ###

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

n = int(input())
# s_list = [input() for i in range(n)]
s_list = []
for i in range(n):
    s = input()
    if s not in s_list:
        s_list.append(s)
    else:
        pass
    
print(len(s_list))

### FIXED CODE ###

n = int(input())
s_list = [input() for i in range(n)]
print(len(set(s_list)))
### BUGGY CODE ###

from heapq import heappop, heappush
import sys
input=sys.stdin.readline


def solve():
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())

    l = [[1 if i=="#" else 0 for i in input()] for _ in range(H)]
    q = [(0, (Ch-1, Cw-1))]
    INF = 10**12
    costs = [[INF]*W for _ in range(H)]
    costs[Ch-1][Cw-1] = 0

    while q:
        cost, pos = heappop(q)
        h, w = pos
        for dh in range(-2, 3):
            for dw in range(-2, 3):
                hh, ww = h+dh, w+dw
                if not (0<=hh<H and 0<=ww<W):
                    continue
                if l[hh][ww]:
                    continue
                
                if ((abs(dh)==1 and dw==0) or (dh==0 and abs(dw)==1)) and costs[hh][ww] > costs[h][w]:
                    costs[hh][ww] = costs[h][w]
                    heappush(q, (cost, (hh, ww)))
                elif costs[hh][ww] > costs[h][w]+1:
                    costs[hh][ww] = costs[h][w]+1
                    heappush(q, (cost+1, (hh, ww)))

    ans = costs[Dh-1][Dw-1]
    print(ans if ans!=INF else -1)


solve()


### FIXED CODE ###

from heapq import heappop, heappush
import sys
input=sys.stdin.readline


def solve():
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())

    l = []
    for _ in range(H):
        s = input()
        l.append([1 if i=="#" else 0 for i in s])

    Ch -= 1
    Cw -= 1
    Dh -= 1
    Dw -= 1

    q = [(0, (Ch, Cw))]
    INF = 10**12
    costs = [[INF]*W for _ in range(H)]
    costs[Ch][Cw] = 0

    while q:
        cost, pos = heappop(q)
        h, w = pos
        for dh in range(-2, 3):
            for dw in range(-2, 3):
                hh = h+dh
                ww = w+dw
                if not (0<=hh<H and 0<=ww<W):
                    continue
                if l[hh][ww]:
                    continue
                
                if (abs(dh)==1 and abs(dw)==0) or (abs(dh)==0 and abs(dw)==1):
                    if costs[hh][ww] > costs[h][w]:
                        costs[hh][ww] = costs[h][w]
                        heappush(q, (cost, (hh, ww)))
                elif costs[hh][ww] > costs[h][w]+1:
                    costs[hh][ww] = costs[h][w]+1
                    heappush(q, (cost+1, (hh, ww)))

    print(costs[Dh][Dw] if costs[Dh][Dw]!=INF else -1)


solve()
### BUGGY CODE ###

K, S = [int(n) for n in input().split()]

def main():
    ns = set()
    for x in range(K + 1):
        for y in range(x + 1):
            z = S - x - y
            if z < 0:
                continue
            if K < z:
                continue
            t = tuple(sorted([x, y, z]))
            ns.add(t)

    ans = 0
    for t in ns:
        x = t[0]
        y = t[1]
        z = t[2]
        if x == y == z:
            ans += 1
        elif x != y != z:
            ans += 6
        else:
            ans += 3
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

K, S = [int(n) for n in input().split()]

def main():

    ans = 0
    for x in range(K + 1):
        for y in range(x + 1):
            z = S - x - y
            if z < 0 or\
                K < z or\
                x < z or\
                y < z:
                continue
            if x == y == z:
                ans += 1
            elif x != y != z:
                ans += 6
            else:
                ans += 3
    print(ans)

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

n=int(input())

s=' '+input()+' '
ans=n
for i in range(1,n+1):
    s1=s[:i]
    s2=s[i+1:]
    sum_count=s1.count('W')+s2.count('E')
    if ans>=sum_count:
        ans=sum_count
        
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
cnt=s[1:].count('E')
res=cnt
for i in range(len(s)-1):
    if s[i]=='W' and s[i+1]=='W':
        cnt+=1
    if s[i]=='E' and s[i+1]=='E':
        cnt-=1
    
    if res>cnt:
        res=cnt
print(res)
### BUGGY CODE ###

n = int(input())
num = list(map(int, input().split()))
ans = "YES"
lis = []
for i in num:
  if not i in lis:
    lis.append(i)
  else:
    ans="NO"
    break
    
print(ans)

### FIXED CODE ###

n = int(input())
num = list(map(int, input().split()))
lenbef = len(num)
numset = set(num)
lenaft = len(numset)

if lenbef == lenaft:
  print("YES")
else:
  print("NO")