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

X, K, D = map(int, input().split())

three_list = []

for i in range(K):
    three_list.append(X)
    
    if len(three_list) >= 4:
        three_list.pop(0)
    if len(three_list) >= 3:
        if three_list[0] == three_list[2]: # 繰り返し
            if (K-i) % 2 == 0: # 偶数
                print(abs(three_list[0]))
            else:
                print(abs(three_list[1]))
            exit()
    if X >= 0:
        X -= D
    else:
        X +=D
print(abs(X))
    

### FIXED CODE ###

X, K, D = map(int, input().split())

hu = False
if X < 0:
    X = abs(X)

idou_kaisu = X//D # 移動回数
amari = X%D # あまり

if idou_kaisu >= K: # すべて一方方向
    print(X - (K*D))
    exit()
else:
    X = amari
    K = K - idou_kaisu

three_list = []

for i in range(K):
    three_list.append(X)
    
    if len(three_list) >= 4:
        three_list.pop(0)
    if len(three_list) >= 3:
        if three_list[0] == three_list[2]: # 繰り返し
            if (K-i) % 2 == 0: # 偶数
                print(abs(three_list[0]))
            else:
                print(abs(three_list[1]))
            exit()
    if X >= 0:
        X -= D
    else:
        X +=D
print(abs(X))
### BUGGY CODE ###

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

min_P = P[0]

for i in range(1, N):
    tmp_P = P[:i]
    if min_P >= P[i]:
        ans += 1
        min_P = P[i]

print(ans)

### FIXED CODE ###

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

min_P = P[0]

for i in range(1, N):
    if min_P >= P[i]:
        ans += 1
        min_P = P[i]

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

from collections import deque

N = int(input())
A = []
for _ in range(N):
    A.append(deque(x - 1 for x in map(int, input().split())))

num_game_left = N * (N - 1) // 2
num_days = 0
left_players = set(range(N))
while 0 < num_game_left:
    game_players = set()
    for i in left_players:
        if i in game_players:
            continue
        j = A[i][0]
        if A[j] and A[j][0] == i:
            game_players.add(i)
            game_players.add(j)
    num_game_left -= len(game_players) // 2

    if not game_players:
        break

    num_days += 1
    for i in game_players:
        A[i].popleft()
        if not A[i]:
            left_players.remove(i)

if num_game_left == 0:
    print(num_days)
else:
    print(-1)

### FIXED CODE ###

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

game = []
for p1 in range(N):
    p2 = A[p1][0]
    if A[p2][0] == p1 and p1 < p2:
        game.append((p1, p2))

cursors = [0] * N
days = 0
while game:
    days += 1
    new_game = []
    for p1, p2 in game:
        cursors[p1] += 1
        if cursors[p1] < N - 1:
            p3 = A[p1][cursors[p1]]
            if cursors[p3] < N - 1 and A[p3][cursors[p3]] == p1:
                new_game.append((p1, p3))
        cursors[p2] += 1
        if cursors[p2] < N - 1:
            p3 = A[p2][cursors[p2]]
            if cursors[p3] < N - 1 and A[p3][cursors[p3]] == p2:
                new_game.append((p2, p3))
    game = new_game

if all(c == N - 1 for c in cursors):
    print(days)
else:
    print(-1)
### BUGGY CODE ###

import array

class UnionFind :
    def __init__(self, n):
        self.par = array.array('i', range(n))


    def root(self, i):
        if i == self.par[i]:
            return i
        else:
            r = self.root(self.par[i])
            self.par[i] = r
            return r


    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        if(rx == ry):
            return
        self.par[rx] = ry
        self.root(x)

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

    def debug(self):
        print(self.par)



def main():
    (n,m) = map(int, input().split())
    ab = []
    for i in range(m):
        (a,b) = map(int, input().split())
        ab.append((a-1,b-1))
    ab = ab[::-1]
    uf = UnionFind(n)
    res = []
    for (a,b) in ab:
        res.append(calcScore(uf, n))
        uf.unite(a,b)
    for i in range(m):
        res[i] = ((n*(n-1)) // 2) - res[i]
    res = res[::-1]
    for r in res:
        print(r)

def calcScore(uf, n):
    nroots = array.array('i', [0] * n)
    for i in range(n):
        root = uf.root(i)
        nroots[root] = nroots[root] + 1
    res = 0
    for r in nroots:
        res = res + (r * (r-1)) // 2
    return res

if __name__ == '__main__':
    main()


### FIXED CODE ###

import array
import time

class UnionFind :
    def __init__(self, n):
        self.par = array.array('i', range(n))
        self.sizes = array.array('i', [1]*n)
        self.rank = array.array('i', [0]*n)


    def root(self, i):
        if i == self.par[i]:
            return i
        else:
            r = self.root(self.par[i])
            self.par[i] = r
            return r

    def unite(self, x, y):
        rx = self.root(x)
        ry = self.root(y)
        srx = self.sized(x)
        sry = self.sized(y)
        if rx != ry:
            if self.rank[rx] < self.rank[ry]:
                self.par[rx] = ry
            else:
                self.par[ry] = rx
                if self.rank[rx] == self.rank[ry]:
                    self.rank[rx] = self.rank[rx] + 1
            self.sizes[self.root(rx)] = srx + sry

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

    def sized(self, x):
        return self.sizes[self.root(x)]

    def debug(self):
        print(self.par)
        print(self.sizes)

def calsc(x):
    return (x * (x-1)) // 2

def main():
    (n,m) = map(int, input().split())
    ab = []
    for _ in range(m):
        (p,q) = map(int, input().split())
        ab.append((p-1,q-1))
    uf = UnionFind(n)
    res = []
    prev = 0
    while len(ab) > 0:
        (a,b) = ab.pop()
        #uf.debug()
        res.append(prev)
        score = prev
        if not uf.same(a,b):
            score = score - calsc(uf.sized(a)) - calsc(uf.sized(b))
            uf.unite(a,b)
            score = score + calsc(uf.sized(a))
        prev = score
    for i in range(len(res)):
        res[i] = calsc(n) - res[i]
    res = res[::-1]
    for r in res:
        print(r)

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

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

L = [L_R[i][0] for i in range(M)]
R = [L_R[i][1] for i in range(M)]

ans = [j+1 for j in range(N)]
for i in range(M):
    ans = [ans[j] for j in range(len(ans)) if L[i] <= ans[j] and ans[j] <= R[i]]
print(len(ans))

### FIXED CODE ###

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

L = [L_R[i][0] for i in range(M)]
R = [L_R[i][1] for i in range(M)]

L_max = max(L)
R_min = min(R)

if L_max <= R_min:
    ans = R_min - L_max + 1
else:
    ans = 0

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

import itertools as itr

N, M = map(int, input().split())
A = [0] * M
B = [0] * M
C = []
for m in range(M):
    A[m], B[m] = map(int, input().split())
    C.append(set([int(cm) for cm in input().split()]))

INF = (10**5) * (10**3)
dp = [[INF] * 2**N for _ in range(M + 1)]
for m in range(M + 1):
    dp[m][0] = 0


def Set2Bit(st):
    bt = ["0"]*N
    for i in st:
        bt[i-1] = "1"
    return bt


for m in range(0, M):
    key = Set2Bit(C[m])
    for bit in itr.product("01", repeat=N):
        pre_bit = next_bit = int("".join(bit), 2)
        dp[m+1][next_bit] = dp[m][pre_bit]
    for bit in itr.product("01", repeat=N):
        pre_bit = int("".join(bit), 2)
        key_bit = int("".join(key), 2)
        next_bit = pre_bit | key_bit
        dp[m+1][next_bit] = min(dp[m+1][next_bit], dp[m][next_bit], dp[m][pre_bit] + A[m])

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


### FIXED CODE ###

N, M = map(int, input().split())
A = [0] * M
B = [0] * M
C = [0]*M
for m in range(M):
    A[m], B[m] = map(int, input().split())
    C[m] = [int(cm) for cm in input().split()]

INF = 100000000
dp = [[INF] * 2**N for _ in range(M + 1)]
dp[0][0] = 0


def Set2Bit(st):
    bt = ["0"]*N
    for i in st:
        bt[i-1] = "1"
    return bt


for m in range(0, M):
    key = Set2Bit(C[m])
    key_bit = int("".join(key), 2)
    for bit in range(2**N):
        pre_bit = next_bit = bit
        dp[m+1][next_bit] = dp[m][pre_bit]
    for bit in range(2**N):
        pre_bit = bit
        next_bit = pre_bit | key_bit
        dp[m+1][next_bit] = min(dp[m+1][next_bit], dp[m][next_bit], dp[m][pre_bit] + A[m])

if dp[-1][-1] == INF:
    print(-1)
else:
    print(dp[-1][-1])
### BUGGY CODE ###

N=int(input())
s=[]
for i in range(N):
    s.append(list(input()))
    s[i].sort()


c=0
for i in range(N):
    for j in range(N-i-1):
        if s[i]==s[j+i+1]:
            c+=1
print(c)


### FIXED CODE ###

N=int(input())
dic={}
for i in range(N):
    k="".join(sorted(list(input())))
    if k in dic:
        dic[k]+=1
    else:
        dic[k]=1
c=0
for i in dic.values():
    c += i*(i-1)

print(c//2)
### BUGGY CODE ###

n,q=map(int,input().split())
s=input()
d=[]
for i in range(q):
  l,r=map(int,input().split())
  d.append(s[l-1:r])
for i in range(q):
  print(d[i].count("AC"))

### FIXED CODE ###

import itertools
n,q=map(int,input().split())
s=input()
lr=[list(map(int,input().split())) for i in range(q)]
ans=[0]*(n+1)

for i in range(len(s)-1):
  if s[i]+s[i+1]=="AC":
    ans[i+1]=1
ansr=list(itertools.accumulate(ans))

for i in range(q):
  if ans[lr[i][1]]==1:
    print(ansr[lr[i][1]]-ansr[lr[i][0]-1]-1)
  else:
    print(ansr[lr[i][1]]-ansr[lr[i][0]-1])
### BUGGY CODE ###

k, s = map(int, input().split())

count=0
for i in range(k+1):
  if i+2*k-s >=0:
    for j in range(k+1):
      if i+j+k-s>=0:
        for h in range(k+1):
          if i+j+h ==s:
            count+=1
print(count)

### FIXED CODE ###

k, s = map(int, input().split())

count=0
for i in range(k+1):
  for j in range(k+1):
    if (s-(i+j)<=k)&(s-(i+j)>=0):
      count+=1
print(count)
### BUGGY CODE ###

from collections import deque


def insert(ary, x):
    ary.appendleft(x)


def delete(ary, x):
    if x in ary:
        ary.remove(x)


def delete_first(ary):
    ary.popleft()


def delete_last(ary):
    ary.pop()


n = int(input())
ary = deque([])

for _ in range(n):
    op = input().split()
    cmd = op[0]

    if cmd[0] == 'i':
        x = int(op[1])
        insert(ary, x)
    elif len(cmd) == 6:
        x = int(op[1])
        delete(ary, x)
    elif len(cmd) == 11:
        delete_first(ary)
    elif len(cmd) == 10:
        delete_last(ary)

print(*ary)



### FIXED CODE ###

import sys
from collections import deque

n = int(input())
ary = deque([])

for line in sys.stdin:
    op = line.strip().split()
    cmd = op[0]

    if cmd == 'insert':
        x = op[1]
        ary.appendleft(x)

    elif cmd == 'delete':
        x = op[1]
        if x in ary:
            ary.remove(x)

    elif cmd == 'deleteLast':
        ary.pop()

    else:
        ary.popleft()

print(*ary)
### BUGGY CODE ###

a,b,k = map(int, input().split())
temp = [ i for i in range(a,b+1)]
for i in sorted(set(temp[:k]+temp[-k:])):
  print(i)

### FIXED CODE ###

a,b,k = map(int, input().split())
small = [i for i in range(a,min(a+k,b+1))]
large = [i for i in range(max(a,b-k+1),b+1)]
for i in sorted(set(small+large)):
  print(i)
### BUGGY CODE ###

s = int(input())

x1 = 0
y1 = 0

def divisor(n):
    i = 1
    while i*i <= n:
        if n%i == 0:
            if n//i < 10 ** 9:
                a = i
                b = n//i
                break
        i += 1
    return a,b

if s == int(s ** 0.5) ** 2:
    a = int(s**0.5)
    b = int(s**0.5)

else:
    a,b = divisor(s)

x2 = a
y2 = 0
x3 = 0
y3 = b

print(x1,y1,x2,y2,x3,y3)

### FIXED CODE ###

S = int(input())

M = 10**9
t = (-S) % M  #M - S%M
x = (S + t) // M

answer = [0,0,1,M,x,t]

print(*answer)
### BUGGY CODE ###

# -*- coding:utf-8 -*-

if __name__ == "__main__":
    N = int(input())
    a_list = list(map(int, input().split()))
    ans = 0

    # 初期設定
    ans = 0
    a_set = set(a_list)

    for a in a_set:
        c = a_list.count(a) # 要素の出現回数をカウントする
        if c < a:
            ans += c
        elif c > a:
            ans += c-a
    print(ans)


### FIXED CODE ###

# -*- coding:utf-8 -*-

def main():
    N = int(input())
    a_list = list(map(int, input().split()))

    # 初期設定
    ans = 0
    a_set = set(a_list)

    for a in a_set:
        c = a_list.count(a) # 要素の出現回数をカウントする
        if c < a:
            ans += c
        elif c > a:
            ans += c-a
    print(ans)

def main2():
    N = int(input())
    a_list = list(map(int, input().split()))
    ans = 0

    import collections
    count_dict = collections.Counter(a_list) # キーに要素、値に出現回数の辞書

    for key in count_dict:
        diff = key - count_dict[key]
        if diff == 0:
            continue
        elif diff > 0:
            ans += count_dict[key]
        elif diff < 0:
            ans += abs(diff)
    print(ans)



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

n=int(input())
s=input()
ans=1000000000000000000000
for i in range(n):
    before=s[0:i]
    after=s[i+1:]
    if before.count("W")+after.count("E")<ans:
        ans=before.count("W")+after.count("E")
print(ans)

### FIXED CODE ###

n=int(input())
s=input()
left=[0]*(n+1)
right=[0]*(n+1)
for i in range(n):
    if s[i]=="W":
        left[i+1]=left[i]+1
    else:
        left[i+1]=left[i]

for i in range(n-1,0,-1):
    if s[i]=="E":
        right[i-1]=right[i]+1
    else:
        right[i-1]=right[i]
print(min([left[i]+right[i] for i in range(n)]))
### BUGGY CODE ###

N=int(input())
A = [input() for x in range(N)]
max=-1
ans=[]
for a in set(A):
  tmp = A.count(a)
  if tmp>max:
    max=tmp
    ans=[a]
  elif tmp==max:
    ans.append(a)

[print(i) for i in sorted(ans)]

### FIXED CODE ###

N=int(input())
d={}
for i in range(N):
  tmp = input()
  if tmp in d:
    d[tmp] += 1
  else:
    d[tmp] = 1

max_v=max(d.values())
ans=list(filter(lambda x: x[1] == max_v, d.items()))
[print(i[0]) for i in sorted(ans)]
### BUGGY CODE ###

class UnionFind(object):
    def __init__(self, size):
        self.parent = list(range(size))
    
    def find(self, x):
        if self.parent[x] == x:
            return x
        else:
            self.parent[x] = self.find(self.parent[x])
            return self.parent[x]
    
    def union(self, x, y):
        x = self.find(x)
        y = self.find(y)
        if x != y:
            self.parent[x] = y

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


h, w = map(int, input().split())
s = [input() for _ in range(h)]

uf = UnionFind(h * w)

diffs = [(1, 0), (-1, 0), (0, 1), (0, -1)]
for i in range(h):
    for j in range(w):
        for di, dj in diffs:
            ni = i + di
            nj = j + dj
            if 0 <= ni < h and 0 <= nj < w and s[i][j] != s[ni][nj]:
                p = i * w + j
                np = ni * w + nj
                uf.union(p, np)
c = 0
for i in range(h * w):
    for j in range(i + 1, h * w):
        if s[i // w][i % w] != s[j // w][j % w] and uf.same(i, j):
            c += 1

print(c)

### FIXED CODE ###

import itertools

h, w = map(int, input().split())
s = [input() for _ in range(h)]

diffs = [(0, 1), (0, -1), (1, 0), (-1, 0)]
t = [[0] * w for _ in range(h)]
group = 1
for i, j in itertools.product(range(h), range(w)):
    if t[i][j] != 0:
        continue

    stack = [(i, j)]
    while stack:
        x, y = stack.pop()
        t[x][y] = group
        for dx, dy in diffs:
            nx = x + dx
            ny = y + dy
            if 0 <= nx < h and 0 <= ny < w and t[nx][ny] == 0 and s[x][y] != s[nx][ny]:
                stack.append((nx, ny))
    group += 1

d = [[0] * 2 for _ in range(group)]
for i, j in itertools.product(range(h), range(w)):
    d[t[i][j]][0 if s[i][j] == '.' else 1] += 1

ans = sum(d[i][0] * d[i][1] for i in range(len(d)))
print(ans)
### BUGGY CODE ###

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

ans = True
for i in range(n-1):
    for j in range(i+1,n):
        if a[j]==a[i]:
            ans = False
            break
        else:
            continue
if ans==True:
    print("YES")
else:
    print("NO")


### FIXED CODE ###

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

if len(A)==len(a):
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

n=int(input())
a=[str(input()) for i in range(n)]
b=set(a)
b=[[i,0]for i in b]
lenb=range(len(b))
for i in lenb:
  for j in a:
    if j==b[i][0]:
      b[i][1]+=1
maxb=max(b,key=lambda x:x[1])
maxb=maxb[1]
b=sorted(b,key=lambda x:x[0])
for i in lenb:
  if b[i][1]==maxb:
    print(b[i][0])
    

### FIXED CODE ###

n=int(input())
a=[str(input()) for i in range(n)]
b={}
for i in a:
  if i in b:
    b[i]+=1
  else:
    b[i]=0
maxb=max(b.values())
b=sorted(b.items(),key=lambda x:x[0])
for i,j in b:
  if maxb==j:
    print(i)
### BUGGY CODE ###

# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''

'''

def solve(adj):
	n = len(adj)
	dis = [maxsize]*n
	ans = [0]*n
	q = [0]
	dis[0] = 0
	while(q):
		src = q.pop(0)
		for nn in adj[src]:
			if(dis[nn] == maxsize):
				ans[nn] = src
				dis[nn] = dis[src] + 1
				q.append(nn)
			else:
				if(dis[nn] > dis[src] + 1):
					ans[nn] = src
					dis[nn] = dis[src] + 1
	for i in range(n):
		ans[i] += 1
	if(maxsize in dis[1:]):
		print('No')
	else:
		print('Yes')
		for i in range(1,n):
			print(ans[i])

N,M = list(map(int, stdin.readline().rstrip().split()))
adj = [[] for i in range(N)]
for _ in range(M):
	a,b = list(map(int, stdin.readline().rstrip().split()))
	a -= 1
	b -= 1
	adj[a].append(b)
	adj[b].append(a)
solve(adj)




### FIXED CODE ###

# ANSHUL GAUTAM
# IIIT-D

from math import *
from copy import *					# ll = deepcopy(l)
from heapq import *					# heappush(hp,x)
from string import *				# alpha = ascii_lowercase
from random import *				# l.sort(key=lambda l1:l1[0]-l1[1]) => ex: sort on the basis difference
from bisect import *				# bisect_left(arr,x,start,end)  => start and end parameters are temporary
from sys import stdin				# bisect_left return leftmost position where x should be inserted to keep sorted
from sys import maxsize				# minn = -maxsize
from operator import *				# d = sorted(d.items(), key=itemgetter(1))
from itertools import *				# pre = [0] + list(accumulate(l))
from collections import Counter		# d = dict(Counter(l))
from collections import defaultdict # d = defaultdict(list)

'''
6 9
3 4
6 1
2 4
5 3
4 6
1 5
6 2
4 5
5 6
'''

def solve(adj):
	n = len(adj)
	dis = [maxsize]*n
	ans = [0]*n
	q = [0]
	dis[0] = 0
	while(q):
		src = q.pop(0)
		for nn in adj[src]:
			if(dis[nn] == maxsize):
				ans[nn] = src
				dis[nn] = dis[src] + 1
				q.append(nn)
	for i in range(n):
		ans[i] += 1
	if(maxsize in dis[1:]):
		print('No')
	else:
		print('Yes')
		for i in range(1,n):
			print(ans[i])

N,M = list(map(int, stdin.readline().rstrip().split()))
adj = [[] for i in range(N)]
for _ in range(M):
	a,b = list(map(int, stdin.readline().rstrip().split()))
	a -= 1
	b -= 1
	adj[a].append(b)
	adj[b].append(a)
solve(adj)
### BUGGY CODE ###

h,w = map(int, input().split())
mat = [[True] * (w+2)]
for _ in range(h):
    mat.append([True] + [a == '#' for a in input()] + [True])
mat.append([True]*(w+2))

prev = []
for i in range(1,h+1):
    for j in range(1,w+1):
        if mat[i][j]:
            prev.append((i,j))

round = -1
while prev:
    round += 1
    next = []
    for x,y in prev:
        if not mat[x-1][y]:
            next.append((x-1,y))
            mat[x-1][y] = True
        if not mat[x][y-1]:
            next.append((x,y-1))
            mat[x][y-1] = True
        if not mat[x+1][y]:
            next.append((x+1,y))
            mat[x+1][y] = True
        if not mat[x][y+1]:
            next.append((x,y+1))
            mat[x][y+1] = True
    prev = next

print(round)


### FIXED CODE ###

import functools as ft

h,w = map(int, input().split())
mat = [[True] * (w+2)]
for _ in range(h):
    mat.append([True] + [a == '#' for a in input()] + [True])
mat.append([True]*(w+2))

prev = []
for i in range(1,h+1):
    for j in range(1,w+1):
        if mat[i][j]:
            prev.append((i,j))



round = -1
while prev:
    round += 1
    #print(prev)
    #print(mat)
    def calc(next, tup):
        x = tup[0]
        y = tup[1]
        if not mat[x-1][y]:
            next.append((x-1,y))
            mat[x-1][y] = True
        if not mat[x][y-1]:
            next.append((x,y-1))
            mat[x][y-1] = True
        if not mat[x+1][y]:
            next.append((x+1,y))
            mat[x+1][y] = True
        if not mat[x][y+1]:
            next.append((x,y+1))
            mat[x][y+1] = True
        return next
    next = ft.reduce(calc, prev, [])

    prev = next

print(round)
### BUGGY CODE ###

def uf_find(x):
  z = x
  while z != p[z]:
    z = p[z]
  p[x] = z
  return z

def uf_unite(x,y):
  x = uf_find(x)
  y = uf_find(y)
  if x != y:
    p[y] = x

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

for i in range(M):
  A, B = [int(i)-1 for i in input().split()]
  uf_unite(A,B)
  #print(p)

for i in range(N):
  p[i] = uf_find(i)
#print(p)

q = [0]*N
for i in range(N):
  q[i] = p.count(i)
  
print(max(q))


### FIXED CODE ###

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

par = list(range(N))
rank = [1]*N
size = [1]*N

def find(x):
  if par[x] == x:
    return x
  else:
    return find(par[x])
  
def unite(x,y):
  x = find(x)
  y = find(y)
  
  if x == y:
    return
  if rank[x]<rank[y]:
    par[x]=y
    size[y]+= size[x]
  else:
    par[y] = x
    size[x] += size[y]
    if rank[x]==rank[y]:
      rank[x]+=1
    
for i in range(M):
  a,b = [int(i)-1 for i in input().split()]
  unite(a,b)
  
print(max(size))
### BUGGY CODE ###

from fractions import gcd
k = int(input())
sum = 0
for a in range(1,k+1):
  for b in range(1,k+1):
    for c in range(1,k+1):
      sum += gcd(gcd(a,b),c)
print(sum)      

### FIXED CODE ###

from math import gcd
k = int(input())
sum = 0
lst = []
for a in range(1,k+1):
  for b in range(1,k+1):
      g = gcd(a,b)
      lst.append(g)
for c in range(1,k+1):
    for i in range(len(lst)):
        sum += gcd(lst[i],c)     
print(sum)
### BUGGY CODE ###

n, k = map(int, input().split())
h = list(map(int, input().split()))

dp = [0] * n

for i in range(1,n):
    a = (dp[j] + abs(h[i] - h[j]) for j in range(max(0,i-k),i))        
    dp[i] = min(a)
    
print(dp[-1])


### FIXED CODE ###

# numpy version

import numpy as np

n, k = map(int, input().split())
h = np.array(list(map(int, input().split())))

dp = np.zeros(n)

for i in range(1,n): 
    j = max(0, i-k)
    dp[i] = np.min(dp[j:i] + np.abs(h[i] - h[j:i]))

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

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

f = 1

if n%2 == 0:
    for i in range(n//2):
        if a.count(i*2+1) != 2:
            f = 0
            break

else:
    if a.count(0) != 1:
        f = 0
    for i in range(n//2):
        if a.count((i+1)*2) != 2:
            f = 0
            break

if f == 0:
    print(f)
else:
    print(2**(n//2))

### FIXED CODE ###

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

f = 1

if n%2 == 0:
    ans = [2]*(n//2)
    #print(ans)
    for i in range(n):
        if a[i]%2 == 0:
            f = 0
            break
        x = a[i]//2
        ans[x] -= 1

else:
    ans = [2]*((n+1)//2)
    ans[0] -= 1
    for i in range(n):
        if a[i]%2 != 0:
            f = 0
            break
        x = a[i]//2
        ans[x] -= 1

for i in range(len(ans)):
    if ans[i] != 0:
        f = 0
        break

if f == 0:
    print(f)
else:
    print((2**(n//2))%1000000007)