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

n=int,input()
a=list(map(int,input().split()))
m=max(a)
ans=0
for i in range(m+2):
    pre=0
    for j in range(len(a)):
        if (a[j]-1<=i) and (i<=a[j]+1):
            pre+=1
        else:
            pre=pre
    ans=max(ans,pre)
    
print(ans)
    

### FIXED CODE ###

from collections import Counter
n=int(input())
a=list(map(int,input().split()))
for i in range(n):
    a.append(a[i]-1)
    a.append(a[i]+1)
c=Counter(a).most_common()
print(c[0][1])
### BUGGY CODE ###

n = int(input())
d = {}
for _ in range(n):
    s = input()
    if not s in d:
        d[s] = 1
    else:
        d[s] += 1
ans = [k for k, v in d.items() if v == max(d.values())]
print('\n'.join(map(str, sorted(ans))))


### FIXED CODE ###

n = int(input())
d = {}
for _ in range(n):
    s = input()
    if not s in d:
        d[s] = 1
    else:
        d[s] += 1
d_max = max(d.values())
ans = [k for k, v in d.items() if v == d_max]
for a in sorted(ans):
    print (a)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
s=[0]*n
for i in range(n):
    c=a.index(i+1)
    s[i]=c+1
for i in range(n):
    print(s[i],end=" ")

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
s=[0]*n
for i in range(n):
    s[a[i]-1]=i+1
print(*s)
### BUGGY CODE ###

N,A,B = [int(x) for x in input().split()]
n = 0
blue = 0
if A == 0:
    print(0)
else:
    for i in range(10**7):
        n = n + A
        blue = blue + A
        if n >= N:
            blue = blue - (n-N)
            break
        else:
            n = n + B
            if n >= N:
                break
    print(blue)

### FIXED CODE ###

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

a = N//(A+B)*A

if N%(A+B) <= A:
    print(a + N%(A+B))
else:
    print(a + A)
### BUGGY CODE ###

#!/usr/bin/env python3
import sys
from collections import deque

def solve(N: int, K: int, V: "List[int]"):

    mani = []
    for ac in range(K+1):
        for bc in range(K+1):
            for cc in range(K+1):
                for dc in range(K+1):
                    if (ac+bc+cc+dc) <= K:
                        mani.append([ac,bc,cc,dc])

    max_v = 0
    for m in mani:
        VV = deque(V)
        MV = []
        lenVV = len(VV)
        for i in range(min(m[0],lenVV)):
            MV.append(VV.popleft())

        lenVV = len(VV)
        for i in range(min(m[1],lenVV)):
            MV.append(VV.pop())

        MV.sort()
        MV = deque(MV)
        for i in range(m[2]+m[3]):
            if len(MV) > 0 and MV[0] < 0:
                MV.popleft()

        max_v = max(max_v,sum(MV))

    print(max_v)



            



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    V = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, K, V)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3
import sys
from collections import deque

def solve(N: int, K: int, V: "List[int]"):

    mani = []
    for ac in range(K+1):
        for bc in range(K+1):
            for cc in range(K+1):
                if (ac+bc+cc) == K:
                    mani.append([ac,bc,cc])

    max_v = 0
    for m in mani:
        VV = deque(V)
        MV = []
        lenVV = len(VV)
        for i in range(min(m[0],lenVV)):
            MV.append(VV.popleft())

        lenVV = len(VV)
        for i in range(min(m[1],lenVV)):
            MV.append(VV.pop())

        MV.sort()
        MV = deque(MV)
        for i in range(m[2]):
            if len(MV) > 0 and MV[0] < 0:
                MV.popleft()

        max_v = max(max_v,sum(MV))

    print(max_v)



            



# Generated by 1.1.4 https://github.com/kyuridenamida/atcoder-tools  (tips: You use the default template now. You can remove this line by using your custom template)
def main():
    def iterate_tokens():
        for line in sys.stdin:
            for word in line.split():
                yield word
    tokens = iterate_tokens()
    N = int(next(tokens))  # type: int
    K = int(next(tokens))  # type: int
    V = [ int(next(tokens)) for _ in range(N) ]  # type: "List[int]"
    solve(N, K, V)

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

N, Y = map(int,input().split())
t = Y//1000+1
counter = 0
for i in range(t):
    for j in range(t):
        for k in range(t):
            if (10000*i+5000*j+1000*k)==Y and (i+j+k)==N and counter == 0:
                counter+=1
                print(i, j, k)
            
if counter == 0:
    print(-1, -1, -1)

### FIXED CODE ###

N, Y = map(int,input().split())#調べる要素が少ないものからループしないと実行時間が間に合わない。
counter = 0
if counter==0:
    for i in range(Y//10000+1):
        if counter==0:   
            for j in range((Y-10000*i)//5000+1):
                    if (10000*i+5000*j+1000*(N-i-j))==Y and counter == 0 and N-i-j>=0:
                        counter+=1
                        print(i, j, (N-i-j))
                        break
if counter == 0:
    print(-1, -1, -1)
### BUGGY CODE ###

k, s = map(int, input().split())
count = 0
for i in range(k+1):
    if i > s:
        break
    for l in range(i+1):
        if i + l > s:
            break
        for j in range(l+1):
            if i + j + l == s:
                if i == j and j == l:
                    count += 1
                elif i != j and i != l and j!= l:
                    count += 6
                else:
                    count += 3 
print(count) 


### FIXED CODE ###

k, s = map(int, input().split())
count = 0
for i in range(k+1):
    for l in range(k+1):
        z = s - i - l
        if 0 <= z <= k:
            count += 1

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

s = input()
q = int(input())
ans = 0
 
for i in range(q):
    c = list(map(str, input().split()))
    if c[0] == '1':
        ans +=1
        ans = ans%2
    if c[0] == '2':
        if (int(c[1])+ans)%2== 1 :
          s = c[2] + s
        if (int(c[1])+ans)%2== 0 :
          s = s + c[2]
 
if ans == 1:
  s = s[::-1]
 
print(s)

### FIXED CODE ###

s=input()
q=int(input())
f=""
b=""
r=0
for i in range(q):
  query=input().split()
  if int(query[0])==1:
    r=1-r
  else:
    if (r^(int(query[1])-1))==0:
      f+=query[2]
    else:
      b+=query[2]
ret=f[::-1]+s+b
if r:
  ret=ret[::-1]
print(ret)
### BUGGY CODE ###

S=input()
keta=len(S)
import numpy as np
dp=np.zeros((keta,26),dtype=int)
DIV=10**9+7

if S[-1]=="?":
  for i in range(10):
    dp[0][i]=1
else:
  dp[0][int(S[-1])]=1
  
dig=1
for i in range(1,keta):
  dig*=10
  if S[keta-1-i]=="?":
    for k in range(10):
      d=k*dig%13
      dp[i][d:d+13]+=dp[i-1][:13]
      dp[i][:13]=dp[i][:13]+dp[i][13:]
      dp[i][13:]*=0
  else:
    ch=int(S[keta-1-i])
    d=ch*dig%13
    dp[i][d:d+13]+=dp[i-1][:13]
    dp[i][:13]=dp[i][:13]+dp[i][13:]
    dp[i][13:]*=0
  dp[i]=dp[i]%DIV

print(dp[len(dp)-1][5])

### FIXED CODE ###

# 各桁についての13で割ったあまりを足し合わせると5になる
# "??"の場合、
# 1桁目が"3"だと、13で割ったあまりは3
# 2桁目が"8"だと、13で割ったあまりは2
# 従い83を13で割ったあまりは5
# 下から数えてN桁目までに、あまりの合計がP(0〜12)になっている数がそれぞれいくつあるかをDPする
# dp[i桁目(下から数える)][あまりの合計]

S = input()
N = len(S)
S = S[::-1] # 逆順にしたほうがやりやすい
dp = [[0] * 13 for i in range(N)]
if S[0] != "?":
  dp[0][int(S[0])] = 1 # 指定の数をとりあえずカウント
else:
  for i in range(10):
    dp[0][i] = 1 # 1桁目は、あまり0〜9になる数が一つずつある
     
# あまりリストの管理 桁数が一つ増えるごとに、各数に対しての13で割ったあまりを計算する
amari = [i for i in range(10)]
amarimap = {1:10,10:9,9:12,12:3,3:4,4:1,2:7,7:5,5:11,11:6,6:8,8:2,0:0}

DIV = 10 ** 9 + 7

# 各桁のあまりの数を更新する
# これにより、桁が増えたときに更新すべきあまりの種類（あまり13種類に対して
# ひと桁は10種類しかない）を管理できる
def update_amari():
  for i in range(len(amari)):
    amari[i] = amarimap[amari[i]]

# 2桁目以降をDP
for i in range(1,N):
  update_amari() # 各桁のあまりをアップデート
  if S[i] == "?":
    # あらゆる数が入る
    # i-1桁目の各数のループと、i桁目のあまりの各数のループ
    for j in range(len(dp[i-1])):
      # 前の桁であまりがjだったとき
      for k in amari:
        dp[i][(j + k) % 13] += dp[i-1][j]
        dp[i][(j + k) % 13] %= DIV
  else:
    # 数が決まっている
    for j in range(len(dp[i-1])):
      # あまりが決まっている
      am = amari[int(S[i])]
      dp[i][(j + am) % 13] += dp[i-1][j]
      dp[i][(j + am) % 13] %= DIV
        
# 最終桁までいったときにあまりが5になる数が必要なので、dp[N-1][5]が答え
print(dp[N-1][5])
### BUGGY CODE ###

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

Left = [[0] * W for _ in range(H)]
for y in range(H):
    count = 0
    for x in range(W):
        if S[y][x] == '#':
            count = 0
        else:
            count += 1
        Left[y][x] = count

Right = [[0] * W for _ in range(H)]
for y in range(H):
    count = 0
    for x in range(W-1, -1, -1):
        if S[y][x] == '#':
            count = 0
        else:
            count += 1
        Right[y][x] = count

Up = [[0] * W for _ in range(H)]
for x in range(W):
    count = 0
    for y in range(H):
        if S[y][x] == '#':
            count = 0
        else:
            count += 1
        Up[y][x] = count

Down = [[0] * W for _ in range(H)]
for x in range(W):
    count = 0
    for y in range(H-1, -1, -1):
        if S[y][x] == '#':
            count = 0
        else:
            count += 1
        Down[y][x] = count

ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        else:
            res = Left[i][j] + Right[i][j] + Up[i][j] + Down[i][j] - 3
            ans = max(ans, res)

print(ans)

### FIXED CODE ###

H, W = map(int, input().split())
S = [list(input()) for _ in range(H)]

Left = [[0] * W for _ in range(H)]
for y in range(H):
    count = 0
    for x in range(W):
        if S[y][x] == '#':
            count = 0
        else:
            count += 1
        Left[y][x] = count

Right = [[0] * W for _ in range(H)]
for y in range(H):
    count = 0
    for x in range(W-1, -1, -1):
        if S[y][x] == '#':
            count = 0
        else:
            count += 1
        Right[y][x] = count

Up = [[0] * W for _ in range(H)]
for x in range(W):
    count = 0
    for y in range(H):
        if S[y][x] == '#':
            count = 0
        else:
            count += 1
        Up[y][x] = count

Down = [[0] * W for _ in range(H)]
for x in range(W):
    count = 0
    for y in range(H-1, -1, -1):
        if S[y][x] == '#':
            count = 0
        else:
            count += 1
        Down[y][x] = count

ans = 0
for i in range(H):
    for j in range(W):
        if S[i][j] == '#':
            continue
        else:
            res = Left[i][j] + Right[i][j] + Up[i][j] + Down[i][j] - 3
            ans = max(ans, res)

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



class dfs():
    
    def __init__(self, n, el):
        self.n = n
        self.el = el

        self.evenl = [1 for i in range(n)]
        self.g = [[0 for j in range(n)] for i in range(n)]

    def calc(self, nf):
        for i in range( len(self.g) ):
            w = self.g[nf][i]
            if w > 0:
                if self.evenl[nf] == 1:
                    if w % 2 == 0:
                        self.evenl[i] = 1
                    else:
                        self.evenl[i] = 0
                else:
                    if w % 2 == 0:
                        self.evenl[i] = 0
                    else:
                        self.evenl[i] = 1

                self.g[nf][i] = 0
                self.g[i][nf] = 0

                self.calc(i)

    def set_g(self):
        for e in self.el:
            u,v,w = e
            self.g[u-1][v-1] = w
            self.g[v-1][u-1] = w


n = int(input())
el = []
for i in range(n-1):
    u,v,w = map( int, input().split() )
    el.append( (u,v,w) )    

m = dfs(n,el)
m.set_g()
m.calc(0)

for item in m.evenl:
    print(item)

### FIXED CODE ###

from collections import deque

n = int(input())
neibors = [[] for i in range(n)]
for i in range(n-1):
    u,v,w = map( int, input().split() )
    neibors[u-1].append( (v-1,w%2) )
    neibors[v-1].append( (u-1,w%2) )

dist = [-1 for i in range(n)]
stack = deque([0])
while( len(stack) != 0 ):
    current = stack.popleft()
    current_dist = dist[current]

    for neibor_n, neibor_w in neibors[current]:
        if dist[neibor_n] == -1:
            stack.append( neibor_n )
            dist[neibor_n] = (neibor_w + current_dist) % 2  

for item in dist:
    print(item)
### BUGGY CODE ###

import numpy as np

N,M = map(int,input().split())
A = np.array(list(map(int,input().split())))

for _ in range(M):
  max_a = np.max(A)
  idx = np.where(A==max_a)
  A[idx[0][0]] = max_a/2
print(np.sum(A))

### FIXED CODE ###

import heapq

N,M = map(int,input().split())
A = []
for a in map(int,input().split()):
  heapq.heappush(A,-a)

cnt = 0
while cnt < M:
  a = heapq.heappop(A)
  heapq.heappush(A,-((-a)//2))
  cnt += 1
print(-sum(A))
### BUGGY CODE ###

n, k = map(int, input().split())
l = list(map(int, input().split()))
tmp = 1
for i in range(k):
    tmp *= l[i]
for i in range(1, n - k + 1):
    check = tmp < tmp / l[i - 1] * l[i + k - 1]
    print("Yes" if check else "No")
    tmp = tmp / l[i - 2] * l[i]

### FIXED CODE ###

n, k = map(int, input().split())
l = list(map(int, input().split()))
for i in range(1, n - k + 1):
    print("Yes" if l[i - 1] < l[i + k - 1] else "No")
### BUGGY CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10

from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# ---------------------------------------

N = inp()
p = [0] + list(map(Decimal, input().split()))
dp = [[0] * (N + 1) for i in range(N + 1)]
dp[0][0] = 1

for i in range(1, N+1):
    for j in range(0, i+1):
        if j > 0:
            dp[i][j] = dp[i-1][j] * (1 - p[i]) + dp[i-1][j-1] * p[i]
        else:
            dp[i][j] = dp[i-1][j] * (1 - p[i])
_debug(dp)
ans = 0
for j in range(N//2 + 1, N + 1):
    ans += dp[N][j]
print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
import decimal
from decimal import Decimal
decimal.getcontext().prec = 10

from heapq import heappush, heappop, heapify
import math
from math import gcd
import itertools as it
import collections
from collections import deque 

def inp():
    return int(input())
def inpl():
    return list(map(int, input().split()))
def _debug(obj):
    print(obj, file=sys.stderr)

# ---------------------------------------

N = inp()
p = [0] + list(map(float, input().split()))
dp = [[0] * (N + 1) for i in range(N + 1)]
dp[0][0] = 1

for i in range(1, N+1):
    for j in range(0, i+1):
        if j > 0:
            dp[i][j] = dp[i-1][j] * (1 - p[i]) + dp[i-1][j-1] * p[i]
        else:
            dp[i][j] = dp[i-1][j] * (1 - p[i])
ans = 0
for j in range(N//2 + 1, N + 1):
    ans += dp[N][j]
print(ans)
### BUGGY CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort()
ans = 0
for a in range(n-2):
    for b in range(a+1,n-1):
        for c in range(b+1,n):
            if l[a]<l[b]+l[c] and l[b]<l[a]+l[c] and l[c]<l[a]+l[b]:
                ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
l = list(map(int,input().split()))
l.sort(reverse=True)
ans = 0
for i in range(n-2):
    for j in range(i+1,n-1):
        a = l[i]
        b = l[j]
        x = (a+1) - b
        y = (b+1) - a
        z = max(x,y)
        a = j+1
        b = n-1
        c = (a+b) // 2
        while a <= b:
            if l[c] == z:
                a += 1
            elif l[c] > z:
                a = c + 1
            elif l[c] < z:
                b = c - 1
            else:
                pass
            c = (a+b) // 2
        ans += c-j
print(ans)
### BUGGY CODE ###

n=int(input())
a=list(map(int,input().split()))
M=10**9+7
each=[]
for i in range(n-1):
  for j in range(i+1,n):
    each.append((a[i]^a[j])%M)
print(sum(each)%M)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
M=10**9+7

ans = 0
for i in range(61):
  ones=sum([1 for a in A if (a>>i)&1])
  ans += (1<<i)*ones*(N-ones)
  ans %= M

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

N, K = map(int, input().split(" "))
H = [int(i) for i in input().split(" ")]

cost = [10**9 for _ in range(N)]
cost[0] = 0
for i in range(1,N):
    for j in range(min(i, K)):
        cand = cost[i-j-1] + abs(H[i-j-1] - H[i])
        if cost[i] > cand:
            cost[i] = cand
print(cost[-1])

### FIXED CODE ###

import numpy as np
N, K = map(int, input().split(" "))
H = np.array([int(i) for i in input().split(" ")])

cost = np.array([0] + [10**9 for _ in range(N-1)])
for i in range(1,N):
    cost[i] = np.min(cost[max(0,i-K):i] + np.abs(H[max(0,i-K):i] - H[i]))

print(cost[-1])
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7

ans = 0
for i in range(n-1):
    for j in range(i+1, n):
        ans += a[i] * a[j] % mod

print(ans % mod)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
mod = 10**9+7

ans = 0

sum_j = [0] * n
sum_tmp = 0

for i in reversed(range(n)):
    sum_tmp += a[i]
    sum_j[i] = sum_tmp

for i in range(n-1):
    ans += a[i] * sum_j[i+1] % mod

print(ans % mod)
### BUGGY CODE ###

N = int(input())
mod = 998244353
# DP ナップサックぽいやつ
# DP[i][j] := a_0からa_iまでの部分集合で和がjになるものの個数
# 配るDPの方が場合分けがなくて簡潔に書ける 計算量増えるかも
# DP[i-1][j]→DP[i][j]とDP[i][j + a_i ]に配る

aaa = [int(input()) for _ in range(N)]
sum_aaa = sum(aaa)

sum_now = 0
DP = [[0] * (sum_aaa+1) for i in range(N)]
DP2 = [[0] * (sum_aaa+1) for i in range(N)]

a = aaa[0]
DP[0][0] = 2
DP[0][a] = 1

DP2[0][0] = 1
DP2[0][a] = 1

sum_now += a

for i in range(1, N):
	a = aaa[i]
	for j in range(sum_now + 1):
		DP[i][j] += DP[i-1][j] * 2
		while (DP[i][j] > mod):
			DP[i][j] -= mod
		DP[i][j + a] += DP[i-1][j]


		DP2[i][j] += DP2[i-1][j]
		while (DP[i][j] > mod):
			DP[i][j] -= mod
		DP2[i][j + a] += DP2[i-1][j]

	sum_now += a

# print(DP2)
minimum_invalid_length = int((sum_now+1)//2)
num_too_long = sum (DP[N-1][minimum_invalid_length:])
if (sum_aaa %2 == 0):
	num_too_long -= DP2[N-1][int(sum_aaa /2)]
# print(num_too_long)
# print(sum(aaa))
print((3** N - num_too_long * 3) % mod )


### FIXED CODE ###

N = int(input())
mod = 998244353
# DP ナップサックぽいやつ
# DP[i][j] := a_0からa_iまでの部分集合で和がjになるものの個数
# 配るDPの方が場合分けがなくて簡潔に書ける 計算量増えるかも
# DP[i-1][j]→DP[i][j]とDP[i][j + a_i ]に配る

aaa = [int(input()) for _ in range(N)]
sum_aaa = sum(aaa)

sum_now = 0
DP = [[0] * (sum_aaa+1) for i in range(N)]
DP2 = [[0] * (sum_aaa+1) for i in range(N)]

a = aaa[0]
DP[0][0] = 2
DP[0][a] = 1

DP2[0][0] = 1
DP2[0][a] = 1

sum_now += a

for i in range(1, N):
	a = aaa[i]
	sum_now += a
	for j in range(sum_now + 1):

		if (j >= a):
			DP[i][j] = DP[i-1][j]*2 + DP[i-1][j-a]
		else:
			DP[i][j] = DP[i-1][j]*2

		while (DP[i][j] > mod):
			DP[i][j] -= mod

	for j in range(min(sum_now + 1, int(sum_aaa /2)+1)):
		if (j >= a):
			DP2[i][j] = DP2[i-1][j] + DP2[i-1][j-a]
		else:
			DP2[i][j] = DP2[i-1][j]

		while (DP2[i][j] > mod):
			DP2[i][j] -= mod

# print(DP2)
minimum_invalid_length = int((sum_now+1)//2)
num_too_long = sum (DP[N-1][minimum_invalid_length:])
if (sum_aaa %2 == 0):
	num_too_long -= DP2[N-1][int(sum_aaa /2)]
# print(num_too_long)
# print(sum(aaa))
print((3** N - num_too_long * 3) % mod )
### BUGGY CODE ###

N,Q = map(int,input().split())
S = input()

check_point = []
inf = 10 ** 18

# AC文字列のAの位置をリストに収めた
for i in range(inf):
  out = S.find('AC')
  if out < 0:
    break
  else:
    S = S[out+2:]
    check_point.append(out + len(check_point) * 2)
  
# 指定した文字列範囲を含む要素数を表示
for i in range(Q):
  start, end  = map(int,input().split())
  list_match = [i for i in check_point if (start - 1 <= i) and (i + 1 < end)]
  out = len(list_match)
  print(out)


### FIXED CODE ###

import sys
 
stdin = sys.stdin

N,Q = map(int,input().split())
S = input()
se = [list(map(int, stdin.readline().split())) for i in range(Q)]

list_out = [0] * N
cnt = 0
f = 0

# AC文字列のAの位置をリストに収めた
for i in range(len(S)):
  if S[i] == 'A':
    f = 1
    list_out[i] = list_out[i-1]    
  elif S[i] == 'C':
    if f == 1:
      cnt += 1
      f = 0
      list_out[i] = cnt
    else:
      list_out[i] = list_out[i-1]
  else:
    f = 0
    list_out[i] = list_out[i-1]    


# 指定した文字列範囲を含む要素数を表示
for i in se:
  print(list_out[i[1]-1] - list_out[i[0]-1])
### BUGGY CODE ###

N = int(input())

As = [int(a) for a in input().split()]


prod = 1

for a in As:
    prod *= a

if prod > 10**18:
    print("-1")
else:
    print(prod)


### FIXED CODE ###

N = int(input())

As = [int(a) for a in input().split()]


prod = 1
overflow_flag = False

if 0 in As:
    print(0)
else:
    for a in As:
        prod *= a

        if prod > 10**18:
            overflow_flag = True
            break

    if overflow_flag:
        print("-1")
    else:
        print(prod)
### BUGGY CODE ###

n = int(input())
a = list(map(int, input().split()))
 
def gcd(n, m):
    if(m): return gcd(m, n%m)
    else: return n
 
def lcm(n, m):
    return n // gcd(n, m) * m
 
LCM = a[0]
for i in range(1, n):
    LCM = lcm(a[i], LCM)
 
res = 0
MOD = 1000000007
for i in range(n):
    res += LCM//a[i]
    
print(res % MOD)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
 
def gcd(n, m):
    if(m): return gcd(m, n%m)
    else: return n
 
def lcm(n, m):
    return n // gcd(n, m) * m
 
LCM = a[0]
for i in range(1, n):
    LCM = lcm(a[i], LCM)
 
res = 0
MOD = 1000000007
for i in range(n):
    res += LCM//a[i]
    
print(res % MOD)
### BUGGY CODE ###

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

DP = [[-10**9 for i in range((N+1)//2)] for i in range(N)]

DP[0][0] = A[0]
for i in range(1,N):
    DP[i][0] = max(DP[i-1][0],A[i])

for i in range(1,N//2-1):
    DP[2*i][i] = DP[2*(i-1)][i-1] + A[2*i]

for i in range(3,N):
    for j in range(1,(i+1)//2):
        DP[i][j] = max(DP[i-1][j],DP[i-2][j-1]+A[i])

print(DP[N-1][N//2-1])


### FIXED CODE ###

from collections import defaultdict

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

DP = defaultdict(lambda: -10**18)

DP[(0,0)] = A[0]

for i in range(1,N):
    for j in range((i+1)//2-1,(i+2)//2):
        if j == 0:
            DP[(i,0)] = max(DP[(i-1,0)],A[i])
        else:
            DP[(i,j)] = max(DP[(i-1,j)],DP[(i-2,j-1)]+A[i])

print(DP[(N-1,N//2-1)])