CodeEff/ECCO huggingface dataset:
# Original solution
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()
    Q = int(eval(input()))
    query = [None] * Q
    for i in range(Q):
        query[i] = input().split()

    prefix = []
    surfix = []
    is_reversed = False
    for q in query:
        if q[0] == "1":
            is_reversed = not is_reversed
        else:
            F, C = q[1], q[2]
            if F == "1":
                if is_reversed:
                    surfix.append(C)
                else:
                    prefix.append(C)
            else:
                if is_reversed:
                    prefix.append(C)
                else:
                    surfix.append(C)

    ans = "".join(["".join(prefix)[::-1], S, "".join(surfix)])
    if is_reversed:
        ans = ans[::-1]

    print(ans)


if __name__ == "__main__":
    main()


# Optimized solution
import sys

input = sys.stdin.readline


def main():
    S = input().rstrip()
    Q = int(eval(input()))
    query = [None] * Q
    for i in range(Q):
        query[i] = input().split()

    prefix = []
    surfix = []
    prefix_append = prefix.append
    surfix_append = surfix.append
    is_reversed = False
    for q in query:
        if q[0] == "1":
            is_reversed = not is_reversed
        else:
            F, C = q[1], q[2]
            if F == "1":
                if is_reversed:
                    surfix_append(C)
                else:
                    prefix_append(C)
            else:
                if is_reversed:
                    prefix_append(C)
                else:
                    surfix_append(C)

    ans = "".join(["".join(prefix)[::-1], S, "".join(surfix)])
    if is_reversed:
        ans = ans[::-1]

    print(ans)


if __name__ == "__main__":
    main()
# Original solution
from collections import deque
s=list(input())
s=deque(s)
q=int(input())
a=0
for i in range(q):
  A=list(input().split())
  if A[0]=="1":
    a=(a+1)%2
  else:
    if A[1]=="1":
      if a==0:
        s.appendleft(A[2])
      else:
        s.append(A[2])
    else:
      if a==0:
        s.append(A[2])
      else:
        s.appendleft(A[2])
if a==1:
  S=[]
  c=len(s)
  for i in range(c):
    S.append(s[c-i-1])
else:
  S=s
for i in range(len(S)):
  print(S[i],end="")
print()


# Optimized solution
from collections import deque
s=list(input())
s=deque(s)
q=int(input())
a=0
for i in range(q):
  A=list(input().split())
  if A[0]=="1":
    a=(a+1)%2
  else:
    if A[1]=="1":
      if a==0:
        s.appendleft(A[2])
      else:
        s.append(A[2])
    else:
      if a==0:
        s.append(A[2])
      else:
        s.appendleft(A[2])
if a==1:
  S=[]
  c=len(s)
  for i in range(c):
    S.append(s[-1])
    s.pop()
else:
  S=s
for i in range(len(S)):
  print(S[i],end="")
print()
# Original solution
import sys
a = sys.stdin.read().split('\n')[:-1]
s = list(a[0])
q = int(a[1])
f = 1
for i in range(2, q + 2):
    if a[i][0] == '1':
        f = 1 - f
    else:
        l = len(s)
        s.insert(0 if a[i][2] == '21'[f] else l, a[i][4])
if f != 1:
    s.reverse()
print((''.join(s)))

# Optimized solution
import sys
a = sys.stdin.read().split('\n')[:-1]
q = int(a[1])
f = 1
l = [[], []]
for i in range(2, q + 2):
    if a[i][0] == '1':
        f = 1 - f
    else:
        l[0 if a[i][2] == '21'[f] else 1].append(a[i][4])
if f != 1:
    l[1].reverse()
    print((''.join(l[1]) + ''.join(reversed(list(a[0]))) + ''.join(l[0])))
else:
    l[0].reverse()
    print((''.join(l[0]) + a[0] + ''.join(l[1])))
# Original solution
S = input()
Q = int(input())
sign = 1
for i in range(Q):
  T = list(map(str, input().split()))
  if T[0] == "1":
    sign *= -1
  else:
    F = int(T[1]) * 2 - 3
    if sign * F == 1:
      S = S[:] + T[2]
    else:
      S = T[2] + S[:]
if sign == 1:
  print(S)
else:
  N = len(S)
  for i in range(N):
    print(S[N-i-1], end = '')
  print()


# Optimized solution
S = input()
N = len(S)
Q = int(input())
sign = 1
L = ["" for i in range(N + 2 * Q)]
for i in range(N):
  L[i+Q] = S[i]
x, y = Q - 1, N + Q
for i in range(Q):
  T = list(map(str, input().split()))
  if T[0] == "1":
    sign *= -1
  else:
    F = int(T[1]) * 2 - 3
    if sign * F == 1:
      L[y] = T[2]
      y += 1
    else:
      L[x] = T[2]
      x -= 1
newS = ""
for i in range(N+2*Q):
  newS = newS[:] + L[i]
if sign == 1:
  print(newS)
else:
  M = len(newS)
  for i in range(M):
    print(newS[M-i-1], end = '')
  print()
# Original solution
from sys import stdin
sin = stdin.readline().rstrip()
q = int(stdin.readline().rstrip())
li = [list(stdin.readline().rstrip().split()) for _ in range(q)]
point = 0
for i in li:
    if i[0] == "1":
        point += 1
    elif i[0] == "2":
        if i[1] == "1":
            if point%2 == 0:
                sin = i[2] + sin
            else:
                sin += i[2]
        else:
            if point%2 == 0:
                sin += i[2]
            else:
                sin = i[2] + sin
if point%2 == 1:
    sin = sin[::-1]
print(sin)

# Optimized solution
from sys import stdin
sin = stdin.readline().rstrip()
q = int(stdin.readline().rstrip())
li = [list(stdin.readline().rstrip().split()) for _ in range(q)]
point = 0
omote = ""
ura = ""
for i in li:
    if i[0] == "1":
        point += 1
    elif i[0] == "2":
        if i[1] == "1":
            if point%2 == 0:
                omote += i[2]
            else:
                ura += i[2]
        else:
            if point%2 == 0:
                ura += i[2]
            else:
                omote += i[2]
if point%2 == 0:
    omote = omote[::-1]
    sin = omote + sin + ura
    print(sin)
else:
    sin = sin[::-1]
    ura = ura[::-1]
    sin = ura + sin + omote
    print(sin)
# Original solution
n=int(eval(input()))
d=''.join([''.join(input().split())for i in range(n//19+(n%19!=0))])
i=0
while True:
 if d.find(str(i))==-1:
  print(i)
  exit() 
 i+=1

# Optimized solution
n=int(eval(input()))
d=''.join(''.join(input().split())for i in[0]*(n//19+(n%19!=0)))
i=0
while 1:
 if d.find(str(i))==-1:
  print(i)
  exit() 
 i+=1
# Original solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W = map(int, readline().split())
    C = [readline().strip() for _ in range(H)]

    ans = [0] * (2 * H)
    for i in range(2 * H):
        ans[i] = C[i // 2]

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

    return


if __name__ == '__main__':
    main()


# Optimized solution
import sys

read = sys.stdin.read
readline = sys.stdin.readline
readlines = sys.stdin.readlines
sys.setrecursionlimit(10 ** 9)
INF = 1 << 60
MOD = 1000000007


def main():
    H, W = list(map(int, readline().split()))
    C = [readline().strip() for _ in range(H)]

    for i in range(2 * H):
        print((C[i // 2]))

    return


if __name__ == '__main__':
    main()
# Original solution
N,A,B = list(map(int, input().split()))

if A % 2 == 0 and B % 2 == 0:
    print("Alice")
elif A % 2 == 0 and B % 2 != 0:
    print("Borys")
elif A % 2 != 0 and B % 2 == 0:
    print("Borys")
elif A % 2 != 0 and B % 2 != 0:
    print("Alice")

# Optimized solution
N,A,B = list(map(int, input().split()))
D = B - A

if D % 2 == 0:
    print("Alice")
else:
    print("Borys")
# Original solution
n,a,b = list(map(int,input().split()))
cnt = 1
while True:
  if cnt % 2 != 0: #alice
    cnt += 1
    a += 1
    if a == b:
      print('Borys')
      break
  else:
    cnt += 1
    b -= 1
    if b == a:
      print('Alice')
      break

# Optimized solution
n,a,b = list(map(int,input().split()))
print(('Alice' if (b-a) % 2 == 0 else 'Borys'))
# Original solution
N, A, B = list(map(int, input().split()))
det = (B-A)%2
if det == 1:
    print('Borys')
else:
    print('Alice')

# Optimized solution
N, A, B = list(map(int, input().split()))
if (B-A)%2 == 0:
    print('Alice')
else:
    print('Borys')
# Original solution
def main():
    n, a, b = list(map(int, input().split()))
    if b - a == 1:
        print("Borys")
    elif (b - a) % 2 == 0:
        print("Alice")
    else:
        print("Borys")
    
    


if __name__ == '__main__':
    main()

# Optimized solution
def main():
    n, a, b = list(map(int, input().split()))
    if (b - a) % 2 == 0:
        print("Alice")
    else:
        print("Borys")

if __name__ == '__main__':
    main()
# Original solution
N,A,B = list(map(int,input().split()))
if abs(A-B)%2==0:
    print("Alice")
else:
    print("Borys")

# Optimized solution
N,A,B = list(map(int,input().split()))
if (B-A)%2==0:
    print("Alice")
else:
    print("Borys")
# Original solution
n,a,b = list(map(int,input().split()))

turn = 1
while abs(a-b) != 1:  
  if turn == 1:
    if a<b:
      if (b-a)%2==0 or a==1: a += 1
      else: a -=1
    else:
      if (a-b)%2==0 or a==n: a -= 1
      else: a +=1
  else:
    if a<b:
      if (b-a)%2==1 or b==1: b += 1
      else: b -=1
    else:
      if (a-b)%2==1 or b==n: b -= 1
      else: b +=1
  turn *= -1
print(('Alice' if turn==-1 else 'Borys'))

# Optimized solution
n,a,b = list(map(int,input().split()))
print(('Alice' if abs(b-a)%2==0 else 'Borys'))
# Original solution
print(('ABloircyes'[eval(input()[2:].replace(' ','-'))%2::2]))

# Optimized solution
print(('ABloircyes'[sum(map(int,input().split()[1:]))%2::2]))
# Original solution
import sys


def slove():
    input = sys.stdin.readline
    mod = 10 ** 9 + 7
    n, a, b = list(map(int, input().rstrip('\n').split()))
    if (a - b) % 2 == 0:
        print("Alice")
    else:
        print("Borys")


if __name__ == '__main__':
    slove()


# Optimized solution
import sys


def solve():
    readline = sys.stdin.buffer.readline
    mod = 10 ** 9 + 7
    n, a, b = list(map(int, readline().split()))
    print(("Alice" if abs(a - b) % 2 == 0 else "Borys"))


if __name__ == '__main__':
    solve()
# Original solution
N, A, B = list(map(int, input().split()))

while 1:
        if A + 1 != B:
                A += 1
        elif A - 1 != 0:
                A -= 1
        else:
                print("Borys")
                break
    
        if B - 1 != A:
                B -= 1
        elif B + 1 != N:
                B += 1
        else:
                print("Alice")
                break

# Optimized solution
N, A, B = list(map(int, input().split()))
if (A % 2 == 0) ^ (B % 2 == 0): 
        print("Borys")
else:
        print("Alice")
# Original solution
n, a, b = list(map(int, input().split()))
if (b - a) % 2 == 0:
    print("Alice")
else:
    print("Borys")

# Optimized solution
n, a, b = list(map(int, input().split()))
if (b - a + 1) % 2:
    print("Alice")
else:
    print("Borys")
# Original solution
from sys import stdin

n,a,b = [int(x) for x in stdin.readline().rstrip().split()]

while True:
    if a+1 != b:
        a += 1
    else:
        print("Borys")
        exit()
    if b-1 != a:
        b -= 1
    else:
        print("Alice")
        exit()

# Optimized solution
from sys import stdin

n,a,b = [int(x) for x in stdin.readline().rstrip().split()]

if (b-a)%2 == 1:
    print("Borys")
else:
    print("Alice")
# Original solution
N = int(eval(input()))
A = [int(Ai) for Ai in input().split()]
cards = len(set(A))
print((cards if cards % 2 == 1 else cards - 1))

# Optimized solution
eval(input())
cards = len(set([Ai for Ai in input().split()]))
print((cards if cards % 2 == 1 else cards - 1))
# Original solution
n = int(eval(input()))

a = list(map(int, input().split()))
set_a = set(a)
nums = {}
cnt = 0
for i in set_a:
    nums[i] = a.count(i)
    if a.count(i) % 2 == 0:
        cnt += 1
    elif a.count(i) != 1:
        cnt += 2

print((len(set_a) - cnt%2))

# Optimized solution
n = int(eval(input()))

a = list(map(int, input().split()))
set_a = set(a)
nums = {}
cnt = 0

for i in range(n):
    nums[a[i]] = nums.get(a[i], 0) + 1


for i in set_a:
    if nums[i] % 2 == 0:
        cnt += 1
    elif nums[i] != 1:
        cnt += 2

print((len(set_a) - cnt%2))
# Original solution
N = int(eval(input()))
A = [int(x) for x in input().split()]
from collections import defaultdict as dd
Sieve = dd(lambda:0)
for a in A:
    Sieve[a] += 1

ans, extra = 0, 0 #extra:同じ数を3枚選んで食べるという操作で「被りカードなし」にできない種類数
for v in list(Sieve.values()):
    ans += 1
    if v > 1 and (v-1)&1:
        extra += 1
#extraから2枚選んで食べれば全体の種類数を減らさずに済む
print((ans if not extra&1 else ans-1))


# Optimized solution
N = int(eval(input()))
A = [int(x) for x in input().split()]

def count(n, Set):
    if not n in Set:
        Set.add(n)
        return 0
    else:
        return 1

Sieve = set()
extra = 0
for a in A:
    extra += count(a, Sieve)
print((N-extra if not extra&1 else N-extra-1))
# Original solution
from collections import  Counter
N = int(eval(input()))
A = list(map(int, input().split()))
A = dict(Counter(A))
even = len(list([x for x in list(A.values()) if x%2==0]))
if even % 2 == 1:
    print((len(A)-1))
else:
    print((len(A)))

# Optimized solution
from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))

ans = len(set(A))
C = Counter(A)
Even = 0
for v in list(C.values()):
    if v % 2 == 0:
        Even += 1

if Even % 2 == 1:
    ans -= 1

print(ans)
# Original solution
from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))

ans = len(set(A))
C = Counter(A)
Even = 0
for v in list(C.values()):
    if v % 2 == 0:
        Even += 1

if Even % 2 == 1:
    ans -= 1

print(ans)


# Optimized solution
from collections import Counter
N = int(eval(input()))
A = list(map(int, input().split()))

C = Counter(A)
even = len([c for c in list(C.values()) if c % 2 == 0])

ans = len(set(A))
if even % 2 == 0:
    print(ans)
else:
    print((ans - 1))
# Original solution
n,*l=list(map(int,open(0).read().split()))
from collections import *
c=Counter(l)
print((len(c)-sum(1-v%2 for v in list(c.values()))%2))

# Optimized solution
_,*l=list(map(int,open(0).read().split()))
c=len(set(l))
print((c-1+c%2))
# Original solution
_,*l=list(map(int,open(0).read().split()))
c=len(set(l))
print((c-1+c%2))

# Optimized solution
eval(input())
c=len(set(input().split()))
print((c-1+c%2))
# Original solution
from collections import Counter
x = int(eval(input()))
a = list(map(int,input().split()))
c = Counter(a)

suma = sum([v for v in list(c.values())])
lenc = len(c)
if suma == lenc:
    print(suma)
    exit()
    
b = suma - lenc
if b % 2 == 0:
    print(lenc)
else:
    print((lenc - 1))
    

# Optimized solution
from collections import Counter
x = int(eval(input()))
a = list(map(int,input().split()))
c = Counter(a)

suma = sum([v for v in list(c.values())])
lenc = len(c)
b = suma - lenc
if b % 2 == 0:
    print(lenc)
else:
    print((lenc - 1))
# Original solution
N=int(eval(input()))
A=list(map(int,input().split()))
S={}
for i in range(N):
  if A[i] in S: S[A[i]]+=1
  else: S[A[i]]=1
d=0
for i in list(S.values()):
  d+=(i-1)
print((len(set(A))-d%2))

# Optimized solution
N=int(eval(input()))
K=len(set(list(map(int,input().split()))))
if K%2==0: print((K-1))
else: print(K)
# Original solution
from collections import Counter
n = int(eval(input()))
a = list(map(int ,input().split()))

cnt = Counter(a) # カードの値をカウント
ans = len(cnt) # 存在する値の数をカウント
if ans%2 == 0: print((ans-1)) # 存在する値の数が偶数であれば1回取り除く必要があるため-1をする
else: print(ans) # 奇数の場合はそのまま

# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))

n = len(set(a))
if n%2 == 0: print((n-1))
else: print(n)
# Original solution
eval(input())
a = list(map(int, input().split()))
c = []
b = [i for i in a if i in c or c.append(i)]
print((len(c) if len(b) % 2 == 0 else len(c)-1))

# Optimized solution
eval(input())
a = list(map(int, input().split()))
c = {}
lb = lc = 0
for i in a:
  try:
    c[i] += 1
    lb += 1
  except:
    c[i] = 1
    lc += 1
print((lc if lb % 2 == 0 else lc-1))
# Original solution
from collections import Counter

n = int(eval(input()))
m = sum(v - 1 for v in list(Counter([int(i) for i in input().split()]).values()))
print((n - round(m + 0.5)))

# Optimized solution
eval(input());k=len(set(input().split()));print((k-1+k%2))
# Original solution
from collections import Counter

N = int(eval(input()))
lst = list(map(int, input().split()))

C = Counter(lst)
odd = 0
even = 0
for c in C:
    if C[c] % 2 == 0:
        even += 1
    else:
        odd += 1

if even % 2 == 0:
    print((len(C)))
else:
    print((len(C) - 1))


# Optimized solution
N = int(eval(input()))
lst = list(map(int, input().split()))

s = len(set(lst))
print(((s - 1)//2 * 2 + 1))
# Original solution
from collections import Counter
N = int(eval(input()))
A = list(map(int,input().split()))
C = list(Counter(A).items())
M = len(C)
print((M if (N-M)%2==0 else M-1))



# Optimized solution
# python3 (3.4.3)
import sys
input = sys.stdin.readline

# main
from collections import Counter
N = int(eval(input()))
A = list(map(int,input().split()))

cnt = len(list(Counter(A).values()))

if cnt%2==0:
    print((cnt-1))
else:
    print(cnt)
# Original solution
from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
ans = N
l = 1
r = 10**5
while l != r or (l == r and C[l] > 1):
    while C[l] <= 1:
        l += 1
    while C[r] <= 1:
        r -= 1

    if l != r:
        res = min(C[l], C[r]) - 1
    else:
        res = C[l]//2
    C[l] -= res
    C[r] -= res
    ans -= 2*res
print(ans)


# Optimized solution
from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
ans = len(C)
if (N-ans) % 2 == 1:
    ans -= 1
print(ans)
# Original solution
from collections import Counter

N = int(eval(input()))
A = list(map(int, input().split()))
C = Counter(A)
ans = len(C)
if (N-ans) % 2 == 1:
    ans -= 1
print(ans)


# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
S = set(A)
ans = len(S)
if (N-ans) % 2 == 1:
    ans -= 1
print(ans)
# Original solution
N = int(eval(input()))
A = list(map(int,input().split()))
count = 0
for i in range(max(A)):
    if A.count(i+1) > 0:
        count += A.count(i+1) -1
N = N - 2*(count // 2 + count % 2)
print(N)

# Optimized solution
N = int(eval(input()))
A = list(map(int,input().split()))
count = [0]*max(A)
for i in A:
    count[i-1] += 1
count = [i for i in count if i != 0]
count = sum(count) - len(count)
N = N - 2*(count // 2 + count % 2)
print(N)
# Original solution
from collections import Counter

n = int(eval(input()))
a = list(map(int, input().split()))
cnt = Counter()
for i in range(n):
    cnt[a[i]] += 1

for a in cnt:
    cnt[a] %= 2
z_o = list(cnt.values())

if list(z_o).count(0) % 2 == 0:
    print((len(cnt)))
else:
    print((len(cnt) - 1))


# Optimized solution
n = int(eval(input()))
a = list(map(int, input().split()))
a_set = set(a)

if len(a_set) % 2 == 0:
    print((len(a_set) - 1))
else:
    print((len(a_set)))
# Original solution
N=int(eval(input()))
*A,=list(map(int,input().split()))
cnt = {}
for a in A:
    cnt[a] = cnt.get(a,0)+1
keys = sorted(cnt.keys())
i = 0
j = len(keys)-1
while i <= j:
    ki,kj = keys[i],keys[j]
    if cnt[ki]<=1:
        i+=1
        continue
    if cnt[kj]<=1:
        j-=1
        continue
    cnt[ki] -= 1
    cnt[kj] -= 1
print((sum(cnt.values())))

# Optimized solution
N = int(eval(input()))
*A, = list(map(int,input().split()))
c = {}
for a in A:c[a] = c.get(a,0)+1
print((len(c) - sum(v-1 for v in list(c.values()))%2))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
m = {}
eat = 1
for a in A:
  if a in m:
    eat += 1
  else:
    m[a] = 1
print((N - 2 * (eat // 2)))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
d = {}
for a in A:
    d[a] = 1
print((len(d) - (0 if len(d) % 2 else 1)))
# Original solution
import functools
N = int(eval(input()))
A = list(map(int, input().split()))
d = [0 for i in range(10 ** 5 + 1)]
for a in A:
    d[a] = 1
s = sum(d)
print((s - (0 if s % 2 else 1)))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
d = [0 for i in range(10 ** 5 + 1)]
for a in A:
    d[a] = 1
s = sum(d)
print((s - (0 if s % 2 else 1)))
# Original solution
N = int(eval(input()))
A = list(map(int, input().split()))
MAX_A = 10**5
dp = [0] * (MAX_A + 1)
for i in range(N):
    dp[A[i]] += 1

tmp = 0
for j in range(MAX_A + 1):
    if dp[j] > 0:
        tmp += dp[j] - 1
tmp += tmp % 2
print((N - tmp))

# Optimized solution
N = int(eval(input()))
A = list(map(int, input().split()))
s = set(A)
k = len(s)
if k % 2:
    ans = k
else:
    ans = k - 1
print(ans)
# Original solution
from collections import Counter

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

C = Counter(A)
ret = len(C)

cnt = []
for v in list(C.values()) :
    if v >= 2 :
        cnt.append(v - 1)

s = sum(cnt)
for c in cnt :
    if c > s // 2 :
        ret -= (2 * c - s) % 2
        break
else :
    ret -= s % 2
        
print(ret)

# Optimized solution
N = int(eval(input()))
A = [int(i) for i in input().split()]

l = len(set(A))
print((l - (N - l) % 2))
# Original solution
import sys

stdin = sys.stdin
def na(): return list(map(int, stdin.readline().split()))
def ns(): return stdin.readline().strip()
def ni(): return int(stdin.readline())

n = ni()
a = na()
lst = []
c=0
for i in a:
    if(i not in lst):
        lst.append(i)
        c = c+1

if(c%2 == 0):c=c-1

print(c)


# Optimized solution
import sys

stdin = sys.stdin
def na(): return list(map(int, stdin.readline().split()))
def ns(): return stdin.readline().strip()
def ni(): return int(stdin.readline())

n = ni()
a = na()
st = set()
for i in a:
    if(i not in st):
        st.add(i)

c = len(st)
if(c%2 == 0):c=c-1

print(c)
# Original solution
from collections import defaultdict as dd
from functools import reduce

if __name__ == "__main__":
    N = int(eval(input()))
    arr = list(map(int, input().split()))

    dic = dd(int)

    for el in arr:
        dic[el] += 1

    count = len(dic) - len(list([x for x in list(dic.values()) if x %
                                       2 == 0])) % 2
    print(count)


# Optimized solution
from collections import Counter
from functools import reduce

if __name__ == "__main__":
    N = int(eval(input()))
    arr = list(map(int, input().split()))

    dic = Counter(arr)
    count = len(dic) - reduce(lambda sum, item: sum + 1, [x for x in list(dic.values()) if x % 2 == 0], 0) % 2
    print(count)
# Original solution
N = int(eval(input()))
list_card = list(map(int, input().split()))
count = 0
for x in set(list_card):
    count += list_card.count(x) - 1
print((N - (count + count%2)))

# Optimized solution
N = int(eval(input()))
list_card = list(map(int, input().split()))
##count = 0
##for x in set(list_card):
##    count += list_card.count(x) - 1
M = N - len(set(list_card))
print((N - (M + M%2)))
# Original solution
# -*- coding: utf-8 -*-

import sys
def input(): return sys.stdin.readline().strip()
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
MOD = 10 ** 9 + 7

from collections import Counter

N = int(eval(input()))
aN = list(map(int, input().split()))

dups = Counter(aN)
for k, v in list(dups.items()):
    dups[k] -= 1
aN = sorted(set(aN))

if sum(dups.values()) % 2 == 0:
    print((len(aN)))
else:
    print((len(aN)-1))


# Optimized solution
# -*- coding: utf-8 -*-

import sys
from collections import Counter

def input(): return sys.stdin.readline().strip()
def list2d(a, b, c): return [[c] * b for i in range(a)]
def list3d(a, b, c, d): return [[[d] * c for j in range(b)] for i in range(a)]
def list4d(a, b, c, d, e): return [[[[e] * d for j in range(c)] for j in range(b)] for i in range(a)]
def ceil(x, y=1): return int(-(-x // y))
def INT(): return int(eval(input()))
def MAP(): return list(map(int, input().split()))
def LIST(N=None): return list(MAP()) if N is None else [INT() for i in range(N)]
def Yes(): print('Yes')
def No(): print('No')
def YES(): print('YES')
def NO(): print('NO')
sys.setrecursionlimit(10 ** 9)
INF = 10 ** 18
MOD = 10 ** 9 + 7

N = INT()
A = LIST()

C = Counter(A)
for k in list(C.keys()):
    C[k] -= 1

cnt = ceil(sum(C.values()), 2)
ans = N - cnt * 2
print(ans)