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

K, S = map(int, input().split())
count = 0

for i in range(K + 1):
  for j in range(K + 1):
    for k in range(K + 1):
      if i + j + k == 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 and S - (i + j) >= 0:
      count += 1

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

n = int(input())

a = 0
while n > 0:
    mod = n % 10
    a += mod
    n = n // 10
if a % 9 == 0:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

n_list = list(input())

a = 0
for num_s in n_list:
    a += int(num_s)

if a % 9 == 0:
    print('Yes')
else:
    print('No')
### BUGGY CODE ###

S=list(input())

dp=[[0 for i in range(13)]for j in range(len(S)+1)]
dp[0][0]=1

for i in range(len(S)):
    if S[i]=="?":
        for j in range(13):
            
            for k in range(10):
                dp[i+1][(10*j+k)%13]+=dp[i][j]
                dp[i+1][(10*j+k)%13]%=(10**9+7)
    else:
        for j in range(13):
            dp[i+1][(10*j+int(S[i]))%13]+=dp[i][j]
            dp[i+1][(10*j+int(S[i]))%13]%=(10**9+7)
print(dp[-1][5])

### FIXED CODE ###

S=list(input())

dp=[[0 for i in range(13)]for j in range(len(S)+1)]
dp[0][0]=1

for i in range(len(S)):
    if S[i]=="?":
        for j in range(13):
            
            for k in range(10):
                dp[i+1][(10*j+k)%13]+=dp[i][j]
                dp[i+1][(10*j+k)%13]%=(10**9+7)
    else:
        for j in range(13):
            dp[i+1][(10*j+int(S[i]))%13]+=dp[i][j]
            dp[i+1][(10*j+int(S[i]))%13]%=(10**9+7)
print(dp[-1][5])
### BUGGY CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse = True)
cost = max([a[i] * f[i] for i in range(n)])
cost2 = 0
while True:
    cost3 = (cost + cost2) // 2
    count = 0
    for i in range(n):
        count += max((a[i] * f[i] - cost3 - 1) // f[i] + 1, 0)
    if count <= k:
        cost = cost3
    else:
        cost2 = cost3 + 1
    if cost == cost2:
        break
print(cost)

### FIXED CODE ###

n, k = map(int, input().split())
a = list(map(int, input().split()))
f = list(map(int, input().split()))
a.sort()
f.sort(reverse = True)
cost = max([a[i] * f[i] for i in range(n)])
cost2 = 0
while True:
    cost3 = (cost + cost2) // 2
    count = 0
    for i in range(n):
        count += max((a[i] * f[i] - cost3 - 1) // f[i] + 1, 0)
    if count <= k:
        cost = cost3
    else:
        cost2 = cost3 + 1
    if cost == cost2:
        break
print(cost)
### BUGGY CODE ###

n=int(input())
a_l=sorted(map(int,input().split()))
a_s=set(a_l)
cnt = 0

for a1 in a_s:
    cnt1 = a_l.count(a1)
    cnt2 = cnt1 - a1
    if cnt2 >= 0:
        cnt += cnt2
    else:
        cnt += cnt1
print(cnt)

### FIXED CODE ###

n=int(input())
a_l=sorted(map(int,input().split()))
a_l.append("!")
cnt = 1
ans = 0

for i in range(1,n+1):
    a1 = a_l[i-1]
    a2 = a_l[i]
    if a1 == a2:
        cnt += 1
    else:
        if cnt - a1 >= 0:
            ans += cnt - a1
        else:
            ans += cnt
        cnt = 1

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

#coding: utf-8
N, Q = map(int, input().split())
S = input()
for i in range(Q):
    q1 = list(map(int, input().split()))
    cnt = 0
    qs = S[q1[0]-1: q1[1]]
    print(qs.count("AC"))

### FIXED CODE ###

#coding: utf-8
N, Q = map(int, input().split())
S = input()
T = [0]
for i in range(N-1):
    if S[i] == "A" and S[i+1] == "C":
        T.append(T[i] + 1)
    else:
        T.append(T[i])
for j in range(Q):
    l, r = map(int, input().split())
    print(T[r-1] - T[l-1])
### BUGGY CODE ###

import numpy as np
N, A, B = map(int, input().split())
h = []
for i in range(N):
    h.append(int(input()))
H = np.array(h)
ans = 0
while len(H[H>0]):
    H = H - B
    H[np.argmax(H)] -= (A-B)
    ans += 1
print(ans)


### FIXED CODE ###

import numpy as np
N, A, B = map(int, input().split())
h = []
for i in range(N):
    h.append(int(input()))
H = np.array(h)

def test(n):
    x = H - n*B
    x[x<0] = 0
    return np.ceil(x/(A-B)).sum() <= n

left = 0
right = 10**9

while right - left > 1:
    mid = (left + right)//2
    if test(mid):
        right = mid
    else:
        left = mid
ans = right
print(ans)
### BUGGY CODE ###

import sys
input = sys.stdin.readline
n, k = [ int(v) for v in input().split() ]
card_parent = [ i for i in range(n) ]
card_set = [ set([i]) for i in range(n) ]
card_list = sorted( [ [ int(v)-1 for v in input().split() ] for i in range(k) ])

 
for i in card_list:
    p, q = i[0], i[1]
    if card_parent[p] != card_parent[q]:
        union_parent, vanish_parent = min(card_parent[p], card_parent[q]), max(card_parent[p], card_parent[q])
        for j in card_set[vanish_parent]:
            card_parent[j] = union_parent
        card_set[union_parent] = card_set[union_parent] | card_set[vanish_parent]

print(len(set(card_parent)))


### FIXED CODE ###


import sys
input = sys.stdin.readline
n, k = [ int(v) for v in input().split() ]
card_parent = [ i for i in range(n) ]
card_set = [ set([i]) for i in range(n) ]
card_list = [ tuple( int(v)-1 for v in input().split() ) for i in range(k) ]

def parent(x,a):
    if card_parent[x] == x:
        return x, a
    else:
        return parent(card_parent[x],a+1)


for i in card_list:
    p, q = i[0], i[1]
    card_parent[p], rank_p = parent(p,0)
    card_parent[q], rank_q = parent(q,0)
    if card_parent[p] != card_parent[q]:
        if rank_p > rank_q:
            card_parent[card_parent[q]] = card_parent[p]
        else:
            card_parent[card_parent[p]] = card_parent[q]




card_parent = [ parent(i,0)[0] for i in range(n) ]

print(len(set(card_parent)))
### BUGGY CODE ###

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

ans = 1
for i in A :
  ans *= i
  
if ans > 1000000000000000000 :
  print("-1")
else :
  print(ans)

### FIXED CODE ###

import sys

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

if 0 in set(A):
  print("0")
  sys.exit()  

ans = 1
for i in A :
  ans *= i
  if ans > 1000000000000000000 :
    print("-1")
    sys.exit()

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

import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]

n = II()
a = LI()

b = [0]*(n+1)
d = [0]*(n+1)
for i in set(a):
    c = a.count(i)
    b[i] += (c*(c-1)/2)
    d[i] += c
sumb = sum(b)
ans = []
for i in a:
    ans.append(int(sumb - (d[i]-1)))
print(*ans, sep='\n')

### FIXED CODE ###

import sys
stdin = sys.stdin
sys.setrecursionlimit(10 ** 7)

def II(): return int(sys.stdin.readline())
def MI(): return map(int, sys.stdin.readline().split())
# 入力全てを整数に変換したものの配列を受け取る
def LI(): return list(map(int, sys.stdin.readline().split()))
# 入力全てを整数に変換して1引いたものの配列を受け取る
def LLI(rows_number): return [LI() for _ in range(rows_number)]

n = II()
a = LI()

b = [0]*(n+1)
count = 0
for i in range(n):
    b[a[i]] += 1
for i in range(n+1):
    count += b[i]*(b[i]-1)/2
for i in a:
    print(int(count-b[i]+1))
### BUGGY CODE ###

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, k = map(int, input().split())
ans = 0
if n == 2:
    if k == 0:
        while 1:
            1
    else:
        ans = -1
else:
    if k > combinations_count(n - 1, 2):
        ans = -1
    else:
        print(combinations_count(n - 1, 2) - k + n - 1)
        delcnt = combinations_count(n - 1, 2) - k
        cnt = 0
        # print(combinations_count(n - 1, 2), delcnt)
        for i in range(2, n + 1):
            if cnt >= delcnt:
                break
            for j in range(i + 1, n + 1):
                print(i, j)
                cnt += 1
                if cnt >= delcnt:
                    break
            if cnt >= delcnt:
                break
        for i in range(1, n):
            print(1, i + 1)

if ans == -1:
    print(ans)

### FIXED CODE ###

import math
def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))

n, k = map(int, input().split())
ans = 0
if n == 2:
    if k == 0:
        print(1)
        print(1, 2)
    else:
        ans = -1
else:
    if k > combinations_count(n - 1, 2):
        ans = -1
    else:
        print(combinations_count(n - 1, 2) - k + n - 1)
        delcnt = combinations_count(n - 1, 2) - k
        cnt = 0
        # print(combinations_count(n - 1, 2), delcnt)
        for i in range(2, n + 1):
            if cnt >= delcnt:
                break
            for j in range(i + 1, n + 1):
                print(i, j)
                cnt += 1
                if cnt >= delcnt:
                    break
            if cnt >= delcnt:
                break
        for i in range(1, n):
            print(1, i + 1)

if ans == -1:
    print(ans)
### BUGGY CODE ###

from collections import deque


def main():
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    S = [input() for _ in range(H)]

    Q = deque([[Ch - 1, Cw - 1, 0]])  # 座標とワープ回数

    cost = [[-1 for _ in range(W)] for _ in range(H)]  # ワープ回数を記録

    while Q:
        r, c, cnt = Q.popleft()

        if cost[r][c] != -1:  # 訪れたことがある
            continue

        cost[r][c] = cnt

        for dr in range(-2, 3):
            for dc in range(-2, 3):
                nr = r + dr
                nc = c + dc

                if 0 <= nr < H and 0 <= nc < W and S[nr][nc] == ".":
                    if abs(dr) + abs(dc) == 1:  # 上下左右
                        Q.appendleft([nr, nc, cnt])
                    elif abs(dr) + abs(dc) >= 2:  # ワープ
                        Q.append([nr, nc, cnt + 1])

    print(cost[Dh - 1][Dw - 1])


if __name__ == "__main__":
    main()


### FIXED CODE ###

from collections import deque


def main():
    H, W = map(int, input().split())
    Ch, Cw = map(int, input().split())
    Dh, Dw = map(int, input().split())
    S = [input() for _ in range(H)]

    Q = deque([[Ch - 1, Cw - 1, 0]])  # 座標とワープ回数

    cost = [[-1 for _ in range(W)] for _ in range(H)]  # ワープ回数を記録

    while Q:
        r, c, cnt = Q.popleft()

        if cost[r][c] != -1:  # 訪れたことがある
            continue

        cost[r][c] = cnt

        for dr in range(-2, 3):
            for dc in range(-2, 3):
                nr = r + dr
                nc = c + dc

                if 0 <= nr < H and 0 <= nc < W and S[nr][nc] == ".":
                    if abs(dr) + abs(dc) == 1:  # 上下左右
                        Q.appendleft([nr, nc, cnt])
                    elif abs(dr) + abs(dc) >= 2:  # ワープ
                        Q.append([nr, nc, cnt + 1])

    print(cost[Dh - 1][Dw - 1])


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

def main():
    n,k,q = [int(x) for x in input().split()]
    life = [k]*n
    a = []
    for i in range(q):
        a.append(int(input()))
    result = ['Yes']*n
    for i in range(q):
        for j in range(n):
            if result[j] == 'No':
                continue
            if a[i] != j+1:
                life[j] -= 1
                if life[j] <= 0:
                    result[j] = 'No'
    for i in range(n):
        print(result[i])

if __name__ == '__main__':
    main()


### FIXED CODE ###

import collections

def main():
    n,k,q = [int(x) for x in input().split()]
    a = []
    for i in range(q):
        a.append(int(input()))

    c = collections.Counter(a)

    for i in range(n):
        index = int('{}'.format(i+1))
        point = k + c[index] - q
        if point > 0:
            print('Yes')
        else:
            print('No')


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

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    import time

    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):

    BM = [[] for _ in range(20)]
    for j, a in enumerate(A):
        n = a
        for i in range(20, -1, -1):
            f = 2**i
            if n >= f:
                n -= f
                BM[i].append(j)

    error_print('-----')

    ans = N
    for i in range(0, N):
        min_r = sys.maxsize
        for bm in BM:
            c = 0
            r = sys.maxsize
            for b in bm:
                if b >= i:
                    c += 1
                if c > 1:
                    r = b - 1
                    break
            else:
                r = N - 1
            min_r = min_r if min_r < r else r
        ans += min_r - i
    return ans


def main():
    N = read_int()
    A = read_int_n()
    # N = 2 * 100000
    # A = [0] * N
    print(slv(N, A))


if __name__ == '__main__':
    main()


### FIXED CODE ###

# -*- coding: utf-8 -*-
import bisect
import heapq
import math
import random
import sys
import time
from collections import Counter, defaultdict
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product


def read_int():
    return int(input())


def read_int_n():
    return list(map(int, input().split()))


def read_float():
    return float(input())


def read_float_n():
    return list(map(float, input().split()))


def read_str():
    return input()


def read_str_n():
    return list(map(str, input().split()))


def error_print(*args):
    print(*args, file=sys.stderr)


def mt(f):
    def wrap(*args, **kwargs):
        s = time.time()
        ret = f(*args, **kwargs)
        e = time.time()

        error_print(e - s, 'sec')
        return ret

    return wrap


@mt
def slv(N, A):
    ans = 0
    S = 0
    X = 0
    r = 0
    for l in range(N):
        while r != N and S + A[r] == X ^ A[r]:
            S += A[r]
            X ^= A[r]
            r += 1
        ans += r - l
        S -= A[l]
        X ^= A[l]

    return ans


def main():
    N = read_int()
    A = read_int_n()

    print(slv(N, A))


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

def upper(arr, x):
    # xよりも大きい最小のindexを返す
    if arr[0] > x:
        return 0
    high, low = len(arr), 0
    while high - low > 1:
        mid = (high + low) // 2
        if arr[mid] > x:
            high = mid
        else:
            low = mid
    return high


def lower(arr, x):
    # xよりも小さい最大のindexを返す
    if arr[-1] < x:
        return len(arr) - 1
    high, low = len(arr) - 1, -1
    while high - low > 1:
        mid = (high + low) // 2
        if arr[mid] < x:
            low = mid
        else:
            high = mid
    return low


A, B, Q = map(int, input().split(' '))
s = [int(input()) for _ in range(A)]
t = [int(input()) for _ in range(B)]

for _ in range(Q):
    x = int(input())
    shr_u, shr_l = upper(s, x), lower(s, x)
    tmp_u, tmp_l = upper(t, x), lower(t, x)
    ans = float('inf')
    if shr_u != A and tmp_u != B:
        ans = min(ans, max(s[shr_u] - x, t[tmp_u] - x))
    if shr_l != -1 and tmp_l != -1:
        ans = min(ans, max(x - s[shr_l], x - t[tmp_l]))
    if shr_l != -1 and tmp_u != B:
        cost = t[tmp_u] - s[shr_l] + min(x - s[shr_l], t[tmp_u] - x)
        ans = min(ans, cost)
    if shr_u != A and tmp_l != -1:
        cost = s[shr_u] - t[tmp_l] + min(s[shr_u] - x, x - t[tmp_l])
        ans = min(ans, cost)
    print(ans)

### FIXED CODE ###

import sys
input = sys.stdin.readline


def upper(arr, x):
    # xよりも大きい最小のindexを返す
    if arr[0] > x:
        return 0
    high, low = len(arr), 0
    while high - low > 1:
        mid = (high + low) // 2
        if arr[mid] > x:
            high = mid
        else:
            low = mid
    return high


def lower(arr, x):
    # xよりも小さい最大のindexを返す
    if arr[-1] < x:
        return len(arr) - 1
    high, low = len(arr) - 1, -1
    while high - low > 1:
        mid = (high + low) // 2
        if arr[mid] < x:
            low = mid
        else:
            high = mid
    return low


A, B, Q = map(int, input().split(' '))
s = [int(input()) for _ in range(A)]
t = [int(input()) for _ in range(B)]

for _ in range(Q):
    x = int(input())
    shr_u, shr_l = upper(s, x), lower(s, x)
    tmp_u, tmp_l = upper(t, x), lower(t, x)
    ans = 10 ** 18
    if shr_u != A and tmp_u != B:
        ans = min(ans, max(s[shr_u] - x, t[tmp_u] - x))
    if shr_l != -1 and tmp_l != -1:
        ans = min(ans, max(x - s[shr_l], x - t[tmp_l]))
    if shr_l != -1 and tmp_u != B:
        cost = t[tmp_u] - s[shr_l] + min(x - s[shr_l], t[tmp_u] - x)
        ans = min(ans, cost)
    if shr_u != A and tmp_l != -1:
        cost = s[shr_u] - t[tmp_l] + min(s[shr_u] - x, x - t[tmp_l])
        ans = min(ans, cost)
    print(ans)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(10**6)

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

g = [[] for _ in range(n)]
c = [0] * n
visited = [False] * n

#根に近い順に累積和
def dfs(i):
    visited[i] = True
    for j in g[i]:
        if visited[j] == True:
            continue
        c[j]+=c[i]
        dfs(j)

for i in range(n - 1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)

for i in range(q):
    p,x = map(int,input().split())
    c[p - 1]+=x

dfs(0)
print(*c)

### FIXED CODE ###

import sys
input = sys.stdin.readline
sys.setrecursionlimit(10**6)
n,q = map(int,input().split())

g = [[] for _ in range(n)]
c = [0] * n
visited = [False] * n

#根に近い順に累積和
def dfs(i):
    visited[i] = True
    for j in g[i]:
        if visited[j] == True:
            continue
        c[j]+=c[i]
        dfs(j)

for i in range(n - 1):
    a,b = map(int,input().split())
    a-=1
    b-=1
    g[a].append(b)
    g[b].append(a)

for i in range(q):
    p,x = map(int,input().split())
    c[p - 1]+=x

dfs(0)
print(*c)
### BUGGY CODE ###

N = int(input())
L_list = sorted([int(x) for x in input().split()])
cnt = 0
for i, a in enumerate(L_list[:-2]):
    for j, b in enumerate(L_list[i+1:-1]):
        for c in L_list[i+j+2:]:
            cnt += (c < a + b)
print(cnt)


### FIXED CODE ###

import bisect
N = int(input())
L = sorted([int(x) for x in input().split()])
cnt = 0
for i in range(N-2):
    for j in range(i+1, N-1):
        cnt +=  bisect.bisect_left(L, L[i]+L[j]) - (j+1)
print(cnt)
### BUGGY CODE ###

import sys
n=int(input())
s=[list(input()) for i in range(n)]
L1=[]
L2=[]
ct1=0;ct2=0
for i in range(n):
  ct3=0
  l=[0]
  for j in range(len(s[i])):
    if s[i][j]=='(':
      ct1+=1
      ct3+=1
      l.append(ct3)
    else:
      ct2+=1
      ct3-=1
      l.append(ct3)
  if l[-1]>=0:
    L1.append((min(l),l[-1]))
  else:
    L2.append((min(l)-l[-1],-l[-1]))
if ct1!=ct2:
  print('No')
  sys.exit()

L1.sort()
L1.reverse()
ct4=0
for i in range(len(L1)):
  if ct4+L1[i][0]<0:
    print('No')
    sys.exit()
  ct4+=L1[i][1]

L2.sort()
L2.reverse()
ct5=0
for i in range(len(L2)):
  if ct5+L2[i][0]<0:
    print('No')
    sys.exit()
  ct5+=L2[i][1]

print('Yes')

### FIXED CODE ###

import sys
n=int(input())
s=[list(input()) for i in range(n)]
L1=[]
L2=[]
ct1=0;ct2=0
for i in range(n):
  ct3=0
  l=[0]
  for j in range(len(s[i])):
    if s[i][j]=='(':
      ct1+=1
      ct3+=1
      l.append(ct3)
    else:
      ct2+=1
      ct3-=1
      l.append(ct3)
  if l[-1]>=0:
    L1.append((min(l),l[-1]))
  else:
    L2.append((min(l)-l[-1],-l[-1]))
if ct1!=ct2:
  print('No')
  sys.exit()

L1.sort()
L1.reverse()
ct4=0
for i in range(len(L1)):
  if ct4+L1[i][0]<0:
    print('No')
    sys.exit()
  ct4+=L1[i][1]

L2.sort()
L2.reverse()
ct5=0
for i in range(len(L2)):
  if ct5+L2[i][0]<0:
    print('No')
    sys.exit()
  ct5+=L2[i][1]

print('Yes')
### BUGGY CODE ###

lx = list(map(int,input().split(" ")))
#la = [li[0]][li[1]]
la = []
cnt = 0

for i in range(0, lx[0]):
    la.append(list(map(int,input().split(" "))))

print("setok")
coin = 0
bottle = 0
for i in range(1, 10 ** 9):
    for j in range(0, lx[0]):
        if (la[j][0] == i):
            while (bottle <= lx[1] and la[j][1] > 0):
                coin += la[j][0]
                bottle += 1
                la[j][1] - 1
    if (bottle == lx[1]):
        break


### FIXED CODE ###

lx = list(map(int,input().split(" ")))
la = []
cnt = 0

for i in range(0, lx[0]):
    la.append(list(map(int,input().split(" "))))

la = sorted(la)

coin = 0
bottle = lx[1]
i = -1
while (bottle > 0 and i < lx[0]-1):
    i += 1
    while (bottle > 0 and la[i][1] > 0):
        coin += la[i][0]
        bottle -= 1
        la[i][1] -= 1

print(coin)
### BUGGY CODE ###

n = int(input())
nums = [int(input()) for _ in range(n)]

for i in range(n):
  print(max(nums[0: i] + nums[i + 1:]))


### FIXED CODE ###

n = int(input())
nums = [int(input()) for _ in range(n)]
max_num = max(nums)
max_cnt = len([i for i in nums if i == max_num])

for i in range(n):
  if nums[i] < max_num or max_cnt > 1:
    print(max_num)
  else:
    print(max(set(nums) - set([nums[i]])))
### BUGGY CODE ###

N = int(input())
S = [input() for i in range(N)]

import itertools
word_list=[]
num_list=[]
for word in S:
  word=''.join(sorted(word))
  word_list.append(word)
  word_set=set(word_list)
  
for word in word_set:
  num = len(list(itertools.combinations(range(word_list.count(word)),2)))
  num_list.append(num)
print(sum(num_list))

### FIXED CODE ###

N = int(input())
S = [input() for i in range(N)]

list = {}
for i in S:
  i=''.join(sorted(i))
  if i in list:
    list[i] = list[i] + 1
  else:
    list[i] = 1

count = 0
for i in list.values():
  n = i - 1
  count = count + int(((n * (n + 1)) / 2))
  
print(count)
### BUGGY CODE ###

n = int(input())
left = 0
right = n - 1
print(left)
sl = input()
if sl[0] == "V":
    quit()
while left < right:
    mid = (left + right) // 2
    print(mid)
    sm = input()
    if sm[0] == "V":
        quit()

    if (mid - left + 1) % 2 == 1 and sm != sl:
        right = mid
        continue
    elif (mid - left + 1) % 2 == 0 and sm == sl:
        right = mid
    else:
        left = mid


### FIXED CODE ###

n = int(input())

left = 0
right = n
print(left, flush=True)
sl = input()
if sl[0] == "V":
    quit()
while right - left > 1:
    mid = (left + right) // 2
    print(mid, flush=True)
    sm = input()
    if sm[0] == "V":
        quit()

    if ((mid - left) % 2 == 1) ^ (sl == sm):
        left = mid
        sl = sm
    else:
        right = mid
### BUGGY CODE ###

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

li = [0] * n
for i in a:
    for j in range(1, n+1):
        if i == j:
            li[j-1] += 1

for ans in li:
    print(ans)
        

### FIXED CODE ###

n = int(input())
a = [-1, 1] + list(map(int, input().split()))
cnt = [0] * (n+1)

for i in range(2, n+1):
    cnt[a[i]] += 1

for i in range(1, n+1):
    print(cnt[i])
### BUGGY CODE ###

from functools import reduce
from operator import mul
largenum = 10**18
def main():
    n = int(input())
    a = list(map(int, input().split()))
    r = int(reduce(mul, a))
    if r > largenum:
        r = -1
    print(r)


if __name__ == '__main__':
    main()


### FIXED CODE ###

import sys
input = sys.stdin.readline
largenum = 10**18
from functools import reduce
from operator import mul
def main():
    n = int(input())
    a = list(map(int, input().split()))

    if 0 in a:
        print(0)
        sys.exit()
    r = 1
    for i1 in range(n):
        r *= a[i1]
        if r > largenum:
            print(-1)
            sys.exit()
    print(r)


if __name__ == '__main__':
    main()