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

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

ans = 1
inf = 10**18 + 1
for i in a:
    ans *= i

ans = min(ans, inf)
if ans == inf:
    print(-1)
else:
    print(ans)

### FIXED CODE ###

n = int(input())
a = map(int, input().split())
a = sorted(a, reverse=True)
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 ###

from collections import Counter, defaultdict

n, m = map(int, input().split())
an = list(map(int, input().split()))
ac = defaultdict(int, Counter(an))
ad = [0] * (n * 2)
for a, c in ac.items():
    for i in range(a - c, a):
        ad[i] += 1
ans = ad[:n].count(0)

for _ in range(m):
    x, y = map(int, input().split())
    ax = an[x - 1]
    xdi = ax - ac[ax]
    ad[xdi] -= 1
    if xdi >= 0 and ad[xdi] == 0:
        ans += 1
    ac[ax] -= 1
    ac[y] += 1
    ydi = y - ac[y]
    ad[ydi] += 1
    if ydi >= 0 and ad[ydi] == 1:
        ans -= 1
    an[x - 1] = y
    print(ans)


### FIXED CODE ###

from collections import Counter

n, m = map(int, input().split())
an = list(map(int, input().split()))
ac_ = Counter(an)
ac = {i: ac_[i] if i in ac_ else 0 for i in range(1, n + 1)}
ad = [0] * n
for a, c in ac.items():
    for i in range(max(0, a - c), a):
        ad[i] += 1
ans = ad.count(0)
anss = []

for x, y in (map(int, input().split()) for _ in range(m)):
    ax = an[x - 1]
    xdi = ax - ac[ax]
    if xdi >= 0:
        ad[xdi] -= 1
        if ad[xdi] == 0:
            ans += 1
    ac[ax] -= 1
    ac[y] += 1
    ydi = y - ac[y]
    if ydi >= 0:
        ad[ydi] += 1
        if ad[ydi] == 1:
            ans -= 1
    an[x - 1] = y
    anss.append(ans)
print('\n'.join(map(str, anss)))
### BUGGY CODE ###

def position_zip(a,flag):
  j=0
  d={}
  for i in sorted(a):
    if i in d:continue
    d[i]=j
    j+=1
  if flag==1:return d
  return [d[i] for i in a]
class BinaryIndexedTree:
  def __init__(self,n):
    self.bit=[0]*n
  def add(self,i,x):
    i+=1
    while i<=len(self.bit):
      self.bit[i-1]+=x
      i+=i&-i
  def sum_sub(self,i):
    a=0
    i+=1
    while i:
      a+=self.bit[i-1]
      i-=i&-i
    return a
  def sum(self,i,j):
    a=self.sum_sub(j+1)
    if i!=0:a-=self.sum_sub(i-1)
    return a
n,q=map(int,input().split())
a=list(map(int,input().split()))
a=position_zip(a,0)
k=max(a)+1
ans=[0]*q
queries=[list(map(lambda x:int(x)-1,input().split()))[::-1]+[i]for i in range(q)]
queries.sort()
queries.append([10*20,0,0])
lastAppeared=[-1]*k
bitt=BinaryIndexedTree(n)
j=0
for i in range(n):
  if lastAppeared[a[i]]!=-1:
    bitt.add(lastAppeared[a[i]],-1)
    bitt.add(i,1)
    lastAppeared[a[i]]=i
  else:
    bitt.add(i,1)
    lastAppeared[a[i]]=i
  while queries[j][0]==i:
    r,l,ind=queries[j]
    j+=1
    ans[ind]=bitt.sum(l,r-1)
print(*ans)

### FIXED CODE ###

def main():
  def add(i,x):
    i+=1
    while i<=n:
      bit[i-1]+=x
      i+=i&-i
  def sum_sub(i):
    a=0
    i+=1
    while i:
      a+=bit[i-1]
      i-=i&-i
    return a
  def sum(i,j):
    a=sum_sub(j+1)
    if i!=0:a-=sum_sub(i-1)
    return a
  
  n,q,*x=map(int,open(0).read().split())
  a=x[:n]
  queries=[]
  for i in range(q):
    l,r=x[n+i*2:n+(i+1)*2]
    l-=1
    r-=1
    queries.append(r<<40|l<<20|i)
  ans=[0]*q
  queries.sort()
  for i in range(q):
    ind=queries[i]%(1<<20)
    queries[i]>>=20
    l=queries[i]%(1<<20)
    queries[i]>>=20
    r=queries[i]
    queries[i]=[r,l,ind]
  queries.append([10*20])
  lastAppeared=[-1]*n
  bit=[0]*n
  j=0
  for i in range(n):
    if lastAppeared[a[i]-1]!=-1:
      add(lastAppeared[a[i]-1],-1)
      add(i,1)
      lastAppeared[a[i]-1]=i
    else:
      add(i,1)
      lastAppeared[a[i]-1]=i
    while queries[j][0]==i:
      r,l,ind=queries[j]
      j+=1
      ans[ind]=sum(l,r-1)
  print(*ans)
if __name__ == "__main__":
  main()
### BUGGY CODE ###

n=int(input())
d=list(map(int,input().split()))
count=0
for i in range(n):
  for j in range(n):
    for k in range(n):
      if d[k]<d[i]+d[j] and d[k]!=d[i] and d[i]!=d[j] and d[j]!=d[k] and d[j]<d[i]+d[k] and d[i]<d[k]+d[j]:
        count+=1
print(int(count/6))

### FIXED CODE ###

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

l.sort(reverse=True)
ans=0

for i in range(0,n-2):
  for j in range(i+1,n-1):
    left = j
    right = n
    while right-left>1:
      mid = (left + right)//2
      
      if l[i]+l[j]>l[mid] and l[i]+l[mid]>l[j] and l[mid]+l[j]>l[i]:
        left = mid
      else:
        right = mid
    #print(i,j,left)
    ans+=(left-j)
      
print(ans)
### BUGGY CODE ###

import itertools

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

days = [i+1 for i, x in enumerate(S) if x == 'o']

wp = list(itertools.combinations(days,K))
wList =[]

for w in wp:
  w = list(w)
  isContinue = False
  for sub in range(len(w)-1):
    if w[sub+1] - w[sub] <= C:
      isContinue = True
  if isContinue == False:
    wList.append(w)

#tp = map(tuple, wList)
#qty = map(lambda x: tp.count(x), tuple(tp))
#print(set(wList[1]) & set([6]))
#print(set(wList[1] & set(6)))

ans = wList[0]
for i in wList:
  ans = (set(i) & set(list(ans)))

ans = sorted(list(ans))
for i in ans:
  print(i)

### FIXED CODE ###

N, K, C = map(int, input().split())
S = input()
S_reverse = S[::-1]

l = []
r = []

i = 0
while i<N and len(l)<K:
    if S[i] == 'o':
        l.append(i+1)
        i += C+1
    else:
        i += 1

i = 0
while i<N and len(r)<K:
    if S_reverse[i] == 'o':
        r.append(i)
        i += C+1
    else:
        i += 1

r = [N - i for i in r]
r.reverse()

ans = []

# print(l)
# print(r)

for i in range(K):
    if l[i] == r[i]:
        ans.append(l[i])


# exit()
# ans = set(l) & set(r)

# ans = list(ans)
ans.sort()

for i in ans:
    print(i)
### BUGGY CODE ###

# -*- coding: utf-8 -*-
H, W, M = map(int, input().split())

h_list = [0 for _ in range(H + 1)]
w_list = [0 for _ in range(W + 1)]
m_list = [[0 for _ in range(W + 1)] for _ in range(H + 1)]
for i in range(M):
    h, w = map(int, input().split())
    h_list[h] += 1
    w_list[w] += 1
    m_list[h][w] = 1

max_h_list = []
max_h = -1
for i in range(H + 1):
    if max_h == h_list[i]:
        max_h_list.append(i)
    elif max_h < h_list[i]:
        max_h = h_list[i]
        max_h_list = [i]

max_w_list = []
max_w = -1
for i in range(W + 1):
    if max_w == w_list[i]:
        max_w_list.append(i)
    elif max_w < w_list[i]:
        max_w = w_list[i]
        max_w_list = [i]

adjust_dupl = 1
for i in range(len(max_h_list)):
    for j in range(len(max_w_list)):
        if m_list[max_h_list[i]][max_w_list[j]] == 0:
            adjust_dupl = 0
            break
    if adjust_dupl == 0:
        break
print(max_h + max_w - adjust_dupl)

### FIXED CODE ###

# -*- coding: utf-8 -*-
H, W, M = map(int, input().split())

h_list = [0 for _ in range(H + 1)]
w_list = [0 for _ in range(W + 1)]
m_dic = {}
for i in range(M):
    h, w = map(int, input().split())
    h_list[h] += 1
    w_list[w] += 1
    m_dic["{}_{}".format(h, w)] = 1

max_h_list = []
max_h = -1
for i in range(H + 1):
    if max_h == h_list[i]:
        max_h_list.append(i)
    elif max_h < h_list[i]:
        max_h = h_list[i]
        max_h_list = [i]

max_w_list = []
max_w = -1
for i in range(W + 1):
    if max_w == w_list[i]:
        max_w_list.append(i)
    elif max_w < w_list[i]:
        max_w = w_list[i]
        max_w_list = [i]

adjust_dupl = 1
for i in range(len(max_h_list)):
    for j in range(len(max_w_list)):
        if "{}_{}".format(max_h_list[i], max_w_list[j]) not in m_dic:
            adjust_dupl = 0
            break
    if adjust_dupl == 0:
        break
print(max_h + max_w - adjust_dupl)
### BUGGY CODE ###

MOD = 10**9+7
N,M = map(int,input().split())
a = [int(input())-1 for _ in range(M)]
ans = [1,0] if (0 in a) else [1,1]
for i in range(1,N):
  if i in a:
    ans.append(0)
  else:
    ans.append(ans[i-1]+ans[i])
print(ans[N]%MOD)

### FIXED CODE ###

import bisect
def f(x,a):
  global M
  b = bisect.bisect_left(a,x)
  if x==a[min(b,M)]:
    return True
  else:
    return False
MOD = 10**9+7
N,M = map(int,input().split())
a = [-1]+[int(input()) for _ in range(M)]
a.sort()
x = 0
y = 1
for i in range(N):
  if f(i,a) and f(i+1,a):
    print(0)
    exit()
  elif f(i+1,a):
    z = 0
  else:
    z = x + y
  x = y
  y = z
print(z%MOD)
### BUGGY CODE ###

n, k = map(int, input().split())
while True:
    if abs(n - k) > n:
        break
    else:
        n = abs(n - k)
print(n)

### FIXED CODE ###

n, k = map(int, input().split())
ans = 0
while True:
    if n > k:
        i = n // k + 1
        n = abs(n - k*i)
        continue
    elif n == k:
        ans = 0
        break
    elif n < k:
        if abs(n - k) > n:
            ans = n
            break
        else:
            ans = k - n
            break

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

n = input()
nums = map(int, input().split(' '))
result = 1
for i in nums:
    result *= i
if result > 10**18:
    print(-1)
else:
    print(result)

### FIXED CODE ###

n = input()
nums = list(map(int, input().split(' ')))
nums.sort()
result = 1
for i in nums:
    result *= i
    if result > 10**18:
        result = -1
        break
    if result == 0:
        break
print(result)
### BUGGY CODE ###

n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in range(n + 1):
    if i in aList:
        num[i] += aList.count(i)
num.sort()
num = num[:-k]
print(sum(num))


### FIXED CODE ###

n, k = map(int, input().split())
aList = list(map(int, input().split()))
num = [0 for _ in range(n + 1)]
for i in aList:
    num[i] += 1
num.sort()
num = num[:-k]
print(sum(num))
### BUGGY CODE ###

import numpy as np
from collections import Counter
import collections
import numpy as np 
from scipy import sqrt, power, exp, log10
from scipy.fftpack import fft, ifft, fftfreq
import tarfile
import re
import os
import glob
from datetime import datetime
import time
import numpy.linalg as LA

round = lambda x:(x*2+1)//2
a,b = list(map(int,input().split()))
S = input()
sub= "AC"
l = np.array([])
for i in range(len(S)):
  S1 = S[:i+1]
  l = np.append(l,S1.count(sub))
for i in range(b):
    r,t = list(map(int,input().split()))
    n = l[t-1]-l[r-1]
    print(int(n))

### FIXED CODE ###

import numpy as np
from collections import Counter
import collections
import numpy as np 
from scipy import sqrt, power, exp, log10
from scipy.fftpack import fft, ifft, fftfreq
import tarfile
import re
import os
import glob
from datetime import datetime
import time
import numpy.linalg as LA

round = lambda x:(x*2+1)//2
a,b = list(map(int,input().split()))
S = input()
sub= "AC"
l = np.zeros(len(S)+1)
for i in range(len(S)):
  l[i+1] = l[i] + (1 if S[i:i+2]=="AC" else 0)

for i in range(b):
    r,t = list(map(int,input().split()))
    n = l[t-1]-l[r-1]
    print(int(n))
### BUGGY CODE ###

def main():
    S = input()
    N = len(S)
    S = int(S)
    work, temp = [0] * 2019, 0
    for i in range(N+1): work[(S % 10**i) % 2019] += 1
    print(sum([w*(w-1)//2 for w in work]))
main()

### FIXED CODE ###

def main():
    S = input()
    work, temp = [0] * 2019, 0
    work[0] = 1
    a = 1
    for s in S[::-1]:
        temp += int(s) * a
        work[temp%2019] += 1
        a *= 10
        a %= 2019
    print(sum([w*(w-1)//2 for w in work]))
main()
### BUGGY CODE ###

n,m,k = map (int,input().split())
def comb(n, r, mod):
  a = 1
  b = 1
  r = min(r, n - r)
  for i in range(r):
    a = a * (n - i) % mod
    b = b * (i + 1) % mod
  return a * pow(b, mod - 2, mod) % mod
mod = 998244353
ans = 0
if k <=  n//2:
    for i in range(k+1):

        ans += (comb (n-1,i,mod) * pow(m-1,n-1-i,mod) * m) % mod
    print(ans % mod)
else:
    for i in range(n-k-1):
        ans += (comb (n-1,k+1+i,mod) * pow(m-1,n-1-(k+1+i),mod) * m) % mod
    print((pow(m,n,mod)-ans) % mod)

### FIXED CODE ###

n,m,k = map (int,input().split())
def cmb(n, r, p):
    if (r < 0) or (n < r):
        return 0
    r = min(r, n - r)
    return fact[n] * factinv[r] * factinv[n - r] % p


p = 998244353
N = n-1  # N は必要分だけ用意する
fact = [1, 1]  # fact[n] = (n! mod p)
factinv = [1, 1]  # factinv[n] = ((n!)^(-1) mod p)
inv = [0, 1]  # factinv 計算用

for i in range(2, N + 1):
    fact.append((fact[-1] * i) % p)
    inv.append((-inv[p % i] * (p // i)) % p)
    factinv.append((factinv[-1] * inv[-1]) % p)

mod = 998244353
ans = 0
#if k <=  n//2:
for i in range(k+1):
    ans += (cmb(n-1,i,mod) * pow(m-1,n-1-i,mod) * m) % mod
print(ans % mod)
### BUGGY CODE ###

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

A = list(map(int, input().split()))
past = [0]*min(K, 2*10**5)
now = 1
step = 0
for i in range(K):
    past[i] = now
    now = A[now-1]
    if now in past:
        step += 1
        break

if step > 0:
    id = past.index(now)
    step = i+1 - id
    p = (K-id) % step
    now = past[id+p]

print(now)

### FIXED CODE ###

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

A = list(map(int, input().split()))
past = [0]*min(K, 2*10**5)
ps = set()
now = 1
step = 0
for i in range(K):
    past[i] = now
    ps.add(now)
    now = A[now-1]
    if now in ps:
        step += 1
        break

if step > 0:
    id = past.index(now)
    step = i+1 - id
    p = (K-id) % step
    now = past[id+p]

print(now)
### BUGGY CODE ###

import sys
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
start = 0
end = k
count = 0
for i in range(n):
    if all(x==1 for x in a):
        print(count)
        sys.exit()
    a[start:end] = [1]*k
    start += (k-1)
    end += (k-1)
    count += 1

### FIXED CODE ###

import sys
n,k = map(int,input().split())
a = list(map(int,input().split()))
a.sort()
start = 0
end = k
count = 0
for i in range(n):
    if a[n-1]==1:
        print(count)
        sys.exit()
    a[start:end] = [1]*k
    start += (k-1)
    end += (k-1)
    count += 1
### BUGGY CODE ###

from collections import deque
# K = 3
# a = [1,3,5,4,2]
# N = len(a)

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

deq = deque()
min_val = [0] * (N - K + 1)
for i in range(N):
  while deq and p[deq[-1]] >= p[i]:
    deq.pop()
  deq.append(i)

  if i - K + 1 >= 0:
    min_val[i - K + 1] = p[deq[0]]
    if deq[0] == i - K + 1:
      deq.popleft()
#print(min_val)

deq = deque()
max_val = [0] * (N - K + 1)
for i in range(N):
  while deq and p[deq[-1]] <= p[i]:
    deq.pop()
  deq.append(i)

  if i - K + 1 >= 0:
    max_val[i - K + 1] = p[deq[0]]
    if deq[0] == i - K + 1:
      deq.popleft()
#print(max_val)

cnt = 0
preL = -1
prerange_min = -2
sortMatchCnt = 0
for i in range(N - K + 1):
  range_min = min_val[i]
  range_max = max_val[i]
  l = p[i]
  r = p[i + K - 1]

  sortMatchFlg = False
  if range_min == l and range_max == r:
    sortMatchFlg = p[i:i + K] == sorted(p[i:i + K])
    if sortMatchFlg:
      sortMatchCnt += 1                      

  if (preL == prerange_min and r == range_max) or sortMatchFlg:
    pass
  else:
    cnt += 1
  preL = l
  # preR = r
  prerange_min = range_min
  # prerange_max = range_max
if sortMatchCnt >= 1:
  print(cnt + 1)
else:
  print(cnt)

### FIXED CODE ###

from collections import deque
import itertools
# K = 3
# a = [1,3,5,4,2]
# N = len(a)

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

deq = deque()
min_val = [0] * (N - K + 1)
for i in range(N):
  while deq and p[deq[-1]] >= p[i]:
    deq.pop()
  deq.append(i)

  if i - K + 1 >= 0:
    min_val[i - K + 1] = p[deq[0]]
    if deq[0] == i - K + 1:
      deq.popleft()
#print(min_val)

deq = deque()
max_val = [0] * (N - K + 1)
for i in range(N):
  while deq and p[deq[-1]] <= p[i]:
    deq.pop()
  deq.append(i)

  if i - K + 1 >= 0:
    max_val[i - K + 1] = p[deq[0]]
    if deq[0] == i - K + 1:
      deq.popleft()
#print(max_val)

incr = [1 if x<y else 0 for x,y in zip(p, p[1:])]
incr_cum = [0] + list(itertools.accumulate(incr))
is_stable = [y-x==K-1 for x,y in zip(incr_cum,incr_cum[K-1:])]

cnt = 0
preL = -1
prerange_min = -2
sortMatchCnt = 0
for i in range(N - K + 1):
  range_min = min_val[i]
  range_max = max_val[i]
  l = p[i]
  r = p[i + K - 1]

  sortMatchFlg = False
  if is_stable[i]:
    sortMatchCnt += 1
    sortMatchFlg = True

  if (preL == prerange_min and r == range_max) or sortMatchFlg:
    pass
  else:
    cnt += 1
  preL = l
  # preR = r
  prerange_min = range_min
  # prerange_max = range_max
if sortMatchCnt >= 1:
  print(cnt + 1)
else:
  print(cnt)
### BUGGY CODE ###

N, W = map(int, input().split())
wv = [[0 for i in range(2)] for j in range(N)]

for i in range(N):
    w, v = map(int, input().split())
    wv[i] = [w, v]

dp = [[10**10 for i in range(2*10**6)] for j in range(2*N)]
dp[0][0] = 0

for i in range(N):
    for j in range(10**6):
        if j - wv[i][1] >= 0:
            dp[i+1][j] = min(dp[i+1][j], dp[i][j-wv[i][1]]+wv[i][0])
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])

ans = 0
for i in range(10**6):
    if dp[N][i] <= W: 
        ans = i
print(ans)


### FIXED CODE ###

N, W = map(int, input().split())
wv = [[0 for i in range(2)] for j in range(N)]

for i in range(N):
    w, v = map(int, input().split())
    wv[i] = [w, v]

dp = [[10**10 for i in range(10**5+100)] for j in range(150)]
dp[0][0] = 0

for i in range(N):
    for j in range(10**5+100):
        if j - wv[i][1] >= 0:
            dp[i+1][j] = min(dp[i+1][j], dp[i][j-wv[i][1]]+wv[i][0])
        dp[i+1][j] = min(dp[i+1][j], dp[i][j])

ans = 0
for i in range(10**5+100):
    if dp[N][i] <= W: 
        ans = i
print(ans)
### BUGGY CODE ###

# D - Lucky PIN
import itertools
 
N = int(input())
S = str(input())
 
# 文字列Sから3文字選ぶ組み合わせを数え上げるとTLE
# 暗証番号の組み合わせが高々1,000通りしかないので、
# それごとに条件に該当するかをチェックしてカウントする。
ans = 0
for i, j, k in itertools.product(range(10),repeat=3):
    # i, j, kの組み合わせが起き得るか
    chk = str(i)+str(j)+str(k)
    idx = 0
    for l in range(N):
        if S[l]==chk[idx]:
            idx += 1
            if idx == 3:
                ans += 1
                break
print(ans)

### FIXED CODE ###

# D - Lucky PIN

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

# 文字列Sから3文字選ぶ組み合わせを数え上げるとTLE
# 暗証番号の組み合わせが高々1,000通りしかないので、
# それごとに条件に該当するかをチェックしてカウントする。
ans = 0
for i in range(10):
    for j in range(10):
        for k in range(10):
            # i, j, kの組み合わせが起き得るか
            chk = str(i)+str(j)+str(k)
            idx = 0
            for s in S:
                if s==chk[idx]:
                    idx += 1
                    if idx == 3:
                        ans += 1
                        break
print(ans)
### BUGGY CODE ###

import sys
import numpy as np


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


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    A = []
    B = []
    for i in range(N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    A = np.array(list(reversed(A)))
    B = np.array(list(reversed(B)))
    ans = 0
    for i in range(N):
        a = A[i]
        b = B[i]
        if a % b > 0:
            btn = b - (a % b)
        else:
            btn = a % b
        ans += btn
        A[i:] += btn
    print(ans)


if __name__ == "__main__":
    main()


### FIXED CODE ###

import sys
import numpy as np


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


sys.setrecursionlimit(10 ** 9)


def main():
    N = int(input())
    A = []
    B = []
    for i in range(N):
        a, b = map(int, input().split())
        A.append(a)
        B.append(b)
    A = np.array(list(reversed(A)))
    B = np.array(list(reversed(B)))
    ans = 0
    for i in range(N):
        a = A[i] + ans
        b = B[i]
        if a % b > 0:
            btn = b - (a % b)
        else:
            btn = a % b
        ans += btn
    print(ans)


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

n=int(input())
a=[]
for i in range(n-1):
    a.append(list(map(int,input().split())))
for i in range(n-2):
    ans=a[i][0]+a[i][1]
    m=0
    while True:
        if ans < a[i + 1][1] + (m+1) * a[i + 1][2]:
            ans=a[i + 1][1] + m * a[i + 1][2]+a[i+1][0]
            break
        else:
            m +=1
    for j in range(i+2,n-1):
        m=0
        while True:
            if ans<a[j][1]+(m+1)*a[j][2]:
                ans=a[j][1]+m*a[j][2]+a[j][0]
                break
            else:
                m+=1
    print(ans)
print(a[n-2][0]+a[n-2][1])
print(0)

### FIXED CODE ###

n = int(input())
c = []
s = []
f = []
for i in range(n-1):
    x,y,z =map(int,input().split())
    c.append(x)
    s.append(y)
    f.append(z)
for i in range(n):
    t = 0
    for j in range(i,n-1):
        if t <s[j]:
            t = s[j]
        elif t%f[j] == 0:
            pass
        else:
            t += f[j] - t%f[j]
        t += c[j]
    print(t)
### BUGGY CODE ###

N = int(input())
line = [int(x) for x in input().split(' ')]
count = 1
prev = line[0]
i = 0
while i < len(line):
  if prev == line[i]:
    i += 1
    continue
  elif prev < line[i]:
    for j in range(i,len(line)):
      if line[j] < prev:
        count+=1
        i = j
        break
      prev = line[j]
  elif prev > line[i]:
    for j in range(i,len(line)):
      if line[j] > prev:
        count += 1
        i = j
        break
      prev = line[j]
  prev = line[i]
  i+=1
print(count)


### FIXED CODE ###

N = int(input())
line = [int(x) for x in input().split(' ')]
count = 1
prev = line[0]
i = 0
while i < len(line):
  if prev == line[i]:
    i += 1
    continue
  elif prev < line[i]:
    for j in range(i,len(line)):
      if line[j] < prev:
        count+=1
        break
      prev = line[j]
    i = j
  elif prev > line[i]:
    for j in range(i,len(line)):
      if line[j] > prev:
        count += 1
        break
      prev = line[j]
    i = j
  prev = line[i]
  i+=1
print(count)
### BUGGY CODE ###

#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
"""
x = I()
ans = 2*(x//11)+1
x %= 11
if x == 0:
    ans -= 1
if x > 6:
    ans += 1
print(ans)
"""

#D
n = I()
a = LI()
d = defaultdict(int)
for i in a:
    d[i] += 1
l = list(d.keys())
i = 0
while i < len(l):
    if d[l[i]] < 2:
        l.pop(i)
        i -= 1
    i += 1
l.sort()
k = 0
for i in l:
    k ^= ~(d[i]%2)
    d[i] = 1
ans = sum(list(d.values()))
ans -= 1 if k%2 else 0
print(ans)
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T


### FIXED CODE ###

#!usr/bin/env python3
from collections import defaultdict
from heapq import heappush, heappop
import sys
import math
import bisect
import random
def LI(): return list(map(int, sys.stdin.readline().split()))
def I(): return int(sys.stdin.readline())
def LS():return list(map(list, sys.stdin.readline().split()))
def S(): return list(sys.stdin.readline())[:-1]
def IR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = I()
    return l
def LIR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = LI()
    return l
def SR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = S()
    return l
def LSR(n):
    l = [None for i in range(n)]
    for i in range(n):l[i] = SR()
    return l
mod = 1000000007

#A

#B

#C
"""
x = I()
ans = 2*(x//11)+1
x %= 11
if x == 0:
    ans -= 1
if x > 6:
    ans += 1
print(ans)
"""

#D
n = I()
a = LI()
d = defaultdict(int)
for i in a:
    d[i] += 1
l = list(d.keys())
i = 0
while i < len(l):
    if d[l[i]] < 2:
        l.pop(i)
        i -= 1
    i += 1
l.sort()
k = 0
for i in l:
    k ^= ~(d[i]%2)
    d[i] = 1
ans = sum(list(d.values()))
ans -= 1 if k%2 else 0
print(ans)
#E

#F

#G

#H

#I

#J

#K

#L

#M

#N

#O

#P

#Q

#R

#S

#T