Harryxun/stf_run huggingface dataset:
# -*- coding: utf-8 -*-
import math
from itertools import combinations_with_replacement


N = int(input())
items = {}
for n in list(range(N)):
  nth, a, b = map(int, input().split())
  items[n] = [nth, a, b]


def calcPosFromMoves(moves: list) -> list:
  points = {"x": 0, "y":0}
  for move in moves:
    points["x"] += move[0]
    points["y"] += move[1]
  return [points["x"], points["y"]]

def createMovePatterns(count: int) -> list:
  moves = [(1,0), (-1,0), (0,1), (0,-1)]
  return list(combinations_with_replacement(moves, count))
 
def observeTwoPoints(_observed: list, _expectation: list) -> bool:
  # print(observed,'?',expectation, '\n')
  result = [o == e for o, e in zip(_observed, _expectation)]
  return all(result)

def possibleMove(item: list) -> bool:
  return False if item[0] < abs(item[1]) + abs(item[2]) else True
    
def readByOneLine(_items: dict) -> list:
  _judges = []
  append = _judges.append
  for _, item in _items.items():  # read one line at once
    if not possibleMove(item): break;
    patterns = createMovePatterns(item[0])
    expectation = [item[1], item[2]]
    for pattern in patterns:  # brute force
      observed = calcPosFromMoves(pattern) 
      if observeTwoPoints(observed, expectation): 
        append(True)
        break;
  return _judges

judges = readByOneLine(items)
print('{}'.format('Yes' if len(judges) == N and all(judges) else 'No' ))

### FIXED CODE ###

# -*- coding: utf-8 -*-
a, b = map(int, input().split())
print("{}".format('Even' if ((a*b)%2 == 0) else 'Odd'))
import math

l=list(map(int,input().split()))
n=l[0]
d=l[1]
print(math.ceil(n/(2d+1)))
  

### FIXED CODE ###

import math

l=list(map(int,input().split()))
n=l[0]
d=l[1]
print(math.ceil(n/(2*d+1)))
N, L = (int(x) for x in input().split())
aji = [L+i for i in range(N)]
left = 0

while (aji[left] < 0):
    left += 1
ans = sum(aji) - aji[left]
print(ans)

### FIXED CODE ###

N, L = (int(x) for x in input().split())
#リンゴiの味はL+i-1で与えられる。（i=1~N）
#作る予定のアップルパイの味の総和はN*(L-1) + 1/2*(N+1)*N
#出力はN-1個からアップルパイを作るとき、元の味との差が最小になる味
#味が0に最も近いものを探して、引けばよい。
aji = [L+i for i in range(N)]
#i=1~Nなので注意
#print(aji)
#0に一番近いものを探索
left = 0
while (aji[left] < 0):
    if left < N-1:
        left += 1
    else:
        break
#print(left)
ans = sum(aji) - aji[left]
print(ans)
from fractions import gcd as g
def l(a,b):
  x=a*b/g(a,b)
  return int(x)
n=int(input())
t=[0]*n
for _ in range(n):
  t[_]=int(input())
m=l(t[0],t[1])
for i in range(1,n):
  m=l(t[i],m)
print(m)


### FIXED CODE ###

from fractions import gcd as g
def l(a,b):
  x=a*b//g(a,b)
  return x
n=int(input())
m=int(input())
for _ in range(n-1):
  t=int(input())
  m=l(m,t)
print(m)
N = int(input())
x = list(map(int, input().split()))

def quicksort(x):
    if x==[]: return []

    smallerSorted = quicksort([a for a in x[1:] if a <= x[0]])
    biggerSorted = quicksort([a for a in x[1:] if a > x[0]])

    return(smallerSorted+[x[0]]+biggerSorted)


y = quicksort(x)
width=[0,0]
height=[0,0]


for i in range(0,len(y)-1):
    if (y[len(y)-1-i]==y[len(y)-2-i] and width[0]==0):
        width[0]=y[len(y)-1-i]
        width[1]=len(y)-1-i
        continue
    if (width!=0 and y[len(y)-1-i]==y[len(y)-2-i]):
        if(len(y)-1-i==width[1]-1):
            continue
        height[0]=y[len(y)-1-i]
        break



print('{0}'.format(int(width[0])*int(height[0])))



quit()

### FIXED CODE ###


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

y=sorted(x)
width=[0,0]
height=[0,0]


for i in range(0,len(y)-1):
    if (y[len(y)-1-i]==y[len(y)-2-i] and width[0]==0):
        width[0]=y[len(y)-1-i]
        width[1]=len(y)-1-i
        continue
    if (width!=0 and y[len(y)-1-i]==y[len(y)-2-i]):
        if(len(y)-1-i==width[1]-1):
            continue
        height[0]=y[len(y)-1-i]
        break



print('{0}'.format(int(width[0])*int(height[0])))



quit()
#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect,copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

h,w=map(int,input().split())
A=[tuple(map(int,input().split())) for i in range(h)]
B=[tuple(map(int,input().split())) for i in range(h)]
K = 55000
dp = [[[]*K for j in range(w)] for i in range(h)]
dp[0][0][0]=1
for i in range(h):
    for j in range(w):
        d=abs(A[i][j]-B[i][j])
        if i-1>=0:
            for k in range(K):
                if dp[i-1][j][k]:
                    dp[i][j][k+d]=1
                    dp[i][j][abs(k-d)]=1
        if j-1>=0:
            for k in range(K):
                if dp[i][j-1][k]:
                    dp[i][j][k+d] = 1
                    dp[i][j][abs(k-d)]=1
for ki in dp[h-1][w-1]:
    ans=min(ans,ki)
print(ans)
# for di in dp:
#     print(di)



### FIXED CODE ###

#!/usr/bin/env python3
import sys, math, itertools, heapq, collections, bisect,copy
input = lambda: sys.stdin.buffer.readline().rstrip().decode('utf-8')
sys.setrecursionlimit(10**7)
inf = float('inf')
mod = 10**9+7
ans = inf ;count = 0 ;pro = 1

h,w=map(int,input().split())
A=[tuple(map(int,input().split())) for i in range(h)]
B=[tuple(map(int,input().split())) for i in range(h)]
# a=[set() for j in range(w)]
K=160*80
dp = [[0]*w for i in range(h)]
dp[0][0]=1<<K
for i in range(h):
    for j in range(w):
        d=abs(A[i][j]-B[i][j])
        if i-1>=0:
            dp[i][j] |= dp[i-1][j]
        if j-1>=0:
            dp[i][j] |= dp[i][j-1]
        dp[i][j] = (dp[i][j]<<d) | (dp[i][j]>>d)


ans = K
for i in range(2*K):
    if dp[h-1][w-1]  & (1 << i)>0:
        ans = min(ans,abs(K-i))
print(ans)
# for di in dp:
#     print(di)
n = int(input())
def get_h(pos,cx,cy,H):
  r= H - abs(pos[0]-cx) - abs(pos[1]-cy)
  return r

points = []
for i in range(n):
  x,y,h = map(int,input().split())
  if h == 0:
    continue
  points.append([x,y,h])
  
ans = []
if ans == []:
  for i in range(101):
    for j in range(101):
      d = get_h(points[0],i,j,0)- get_h(points[1],i,j,0)
      if points[0][2]- points[1][2] == d:
        ans.append([i,j])
for k in range(len(points)):
  for l in range(k+1,len(points)):
    for elem in ans[:]:
      i = elem[0]
      j = elem[1]
      if points[k][2] - points[l][2] != abs(points[l][0]-i) + abs(points[l][1]-j)- abs(points[k][0]-i)-abs(points[k][1]-j):
        ans.remove(elem)
h = abs(points[0][0]-ans[0][0])+abs(points[0][1]-ans[0][1]) + points[0][2]
print('{} {} {}'.format(ans[0][0],ans[0][1],h))

### FIXED CODE ###

n = int(input())
if n == 1:
  print('Hello World')
else:
  print(sum([int(input()) for i in range(2)]))
def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    a = int(input())
    for i in range(3):
        ans += a**(i+1)
    print(ans)


if __name__ == '__main__':
    main()

### FIXED CODE ###

def main():
    import sys
    def input(): return sys.stdin.readline().rstrip()
    a = int(input())
    ans = 0
    for i in range(3):
        ans += a**(i+1)
    print(ans)


if __name__ == '__main__':
    main()
s = list(input())
lst = []
ans = 0
for i in s:
    if i == "A" or i == "C" or i == "G" or i == "T":
        ans += 1
    else:
        lst.append(ans)
        ans = 0
print(max(lst))

### FIXED CODE ###

s = list(input())
lst = []
ans = 0
c = 0
for i in s:
    if i == "A" or i == "C" or i == "G" or i == "T":
        ans += 1
        c = max(c,ans)
    else:
        ans = 0
print(c)
n, q = map(int, input().split())

#print(n,q)
edge = []
for i in range(n-1):
    a = list(map(int, input().split()))
    edge.append(a)

add_list = []
for i in range(q):
    p = list(map(int, input().split()))
    add_list.append(p)

#print(edge,add_list)


dir_edge = []
for i in range(n):
    dir_edge.append([])

for e in edge:
    dir_edge[e[0]-1].append(e[1]-1)
    dir_edge[e[1]-1].append(e[0]-1)
#print(dir_edge)


ans = [0]*n
for v in add_list:
    ans[v[0]-1] += v[1]
#print(add_value)


def dfs(index, parent,value):
    if parent != -1:
        ans[index] += ans[parent]
    for i in dir_edge[index]:
        if (parent == i):
            continue
        dfs(i,index,value)
        

dfs(0, -1, 0)
print(*ans)

### FIXED CODE ###

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

#print(n,q)
edge=[]
for i in range(n-1):
    a = list(map(int,input().split()))
    edge.append(a)

add_list = []
for i in range(q):
    p = list(map(int,input().split()))
    add_list.append(p)

#print(edge,add_list)

ans = [0] * n
edge_list = [-1] * n

for e in edge:
    edge_list[e[1]-1] = e[0]-1

add_value = [0]*n
for v in add_list:
    add_value[v[0]-1] += v[1]

#print(edge_list)
#print(add_value)


dp = [-1] * n
def get_value(i):
    if(dp[i]!=-1):
        return dp[i]
    tmp = add_value[i]
    if edge_list[i] != -1:
        tmp += get_value(edge_list[i])
    dp[i] = tmp
    return dp[i]

for i in range(n):
    ans[i] = get_value(i)
    #print(i,ans)

print(' '.join(map(str,ans)))
n=int(input())
a=list(map(int,input().split())
ans=0

while True:
  if[i for i in a if i%2==1]:
    break
  a=[i/2 for i in a]
  ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
a=list(map(int,input().split()))
ans=0
while True:
    if [i for i in a if i % 2 == 1]:
        break
    a=[i/2 for i in a]
    ans+=1
print(ans)
N = int(input())
i = 1
while i <= N:
    i = i*2
peint(i//2)

### FIXED CODE ###

N = int(input())
i = 1
while i <= N:
    i = i*2
print(i//2)
N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  print(n, p, e)
  while n >= (p ** e) 
and n % (p ** e) == 0:
    n = n // (p ** e)
    score += 1
    e += 1
  else:
    p = p + 1 if p == 2 else p + 2
else:
  if n != 1:
    score += 1
print(score)

### FIXED CODE ###

N = int(input())
n, p, score = N, 2, 0
while p ** 2 <= N:
  e = 1
  # print(n, p, e)
  while n >= (p ** e) and n % (p ** e) == 0:
    n = n // (p ** e)
    score += 1
    e += 1
  else:
    while n >= p and n % p == 0:
      n = n // p
    p = p + 1 if p == 2 else p + 2
else:
  if n != 1:
    score += 1
print(score)
S = input()

ans = ""

if(S=="Sunny")
	print("Cloudy")
else if(S=="Rainy")
	print("Sunny")
else
	print("Rainy")


### FIXED CODE ###

S = input()

ans = ""

if S=="Sunny":
	print("Cloudy")
elif S=="Rainy":
	print("Sunny")
else:
	print("Rainy")
n,k = map(int,input().split())
l = list(map(int, input().split()))
freq = [0]*n
for i in l:
    freq[i]+=1
freq.sort()
vf = len(freq) - k if len(freq)> k else 0
print(sum(freq[:vf]))

### FIXED CODE ###

n,k = map(int,input().split())
l = list(map(int, input().split()))
freq = [0]*(n+1)
for i in l:
    freq[i]+=1
freq.sort()
vf = len(freq) - k if len(freq)> k else 0
print(sum(freq[:vf]))
N = input()
L = list(map(int,input().split())
 
L.sort()
 
s = 0
 
for n in range(N):
    s += L[2*n]
print(s)

### FIXED CODE ###

n = int(input())
list_L = list(map(int, input().split()))
list_L.sort()
sum = 0
for i in range(n):
    sum += list_L[2*i]
print(sum)
import math
N, M = map(int, input().split())
S = list(input())
T = list(input())

lcm = (N * M) // math.gcd(N, M)
ans = lcm
ansS = ["0"]*lcm
ansT = ["0"]*lcm
Sp = lcm//N
Tp = lcm//M


for i in range(10000000000):
    if Sp*i > lcm:
        break
    if i > N:
        break
    ansS[Sp*i] = S[i]

for i in range(10000000000):
    if Tp*i > lcm:
        break
    if i > M:
        break
    ansT[Tp*i] = T[i]

for i in range(lcm):
    if ansS[i] == "0" or ansT[i] == "0":
        continue
    if ansS[i] != ansT[i]:
        ans = -1
        break
print(ans)


### FIXED CODE ###

import math
N, M = map(int, input().split())
S = list(input())
T = list(input())
lcm = (N * M) // math.gcd(N, M)
ans = lcm
Sp = lcm//N
Tp = lcm//M
lcmlcm = (Sp * Tp) // math.gcd(Sp, Tp)
owari = min(Sp*N, M*Tp)
for i in range(0, owari, lcmlcm):
    if S[i//Sp] != T[i//Tp]:
        ans = -1
        break
print(ans)
n,b,sta=map(int,input().split())
A=list(map(int,input().split()))
Z=["F" for i in range(n+1)]
for i in A:
  A[i]="B"
fi=A[:sta:]
se=A[sta+1::]
print(min(fi.count("B"),se.count("B")))


### FIXED CODE ###

n,b,sta=map(int,input().split())
A=list(map(int,input().split()))
Z=["F" for i in range(n+1)]
for i in A:
  Z[i]="B"
fi=Z[:sta:]
se=Z[sta+1::]
print(min(fi.count("B"),se.count("B")))
n,r = int(input()),int(input) #コンテストの参加回数と表示レーティング

if n >= 10:
  print(r)
else:
  in_rate = r + 100 * (10 - n)
  print(in_rate)

### FIXED CODE ###

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

if n >= 10:
  print(r)
else:
	in_rate = r + 100 * (10-n)
	print(in_rate)
import math
try:
    a,b,c,d=map(int,input().split())

    def lcm(x,y):
        return (x*y)//math.gcd(x,y)

    def ans_cnt(i,y,z):
        return i - (i//y + i//z - i//lcm(y,z))

    print(ans_cnt(b,c,d)-ans_cnt(a-1,c,d))
except EOFError:
    pass

### FIXED CODE ###

from fractions import gcd
a,b,c,d=map(int,input().split())

def lcm(x,y):
    return (x*y)//gcd(x,y)

def ans_cnt(i,y,z):
    return i - (i//y + i//z - i//lcm(y,z))

print(ans_cnt(b,c,d)-ans_cnt(a-1,c,d))
a,b,c,d,e = map(int,input(). split ())
for i in 5:
    if i * 1 == 0:
        print(i)

### FIXED CODE ###

a,b,c,d,e = map(int,input(). split ())
x = [a,b,c,d,e]
for i in x:
    if i * 1 == 0:
        print(x.index(i) + 1)
A, B, C, X, Y = map(int, input().split())
ans = float('inf')
for i in range(10**5 + 1):
    price = 2*C*i + A*max(0, X - i) + B*max(0, Y - i)
    if ans > price:
        ans = price

print(ans)

### FIXED CODE ###

S = input()
price = 700
if S[0] == 'o':
    price += 100
if S[1] == 'o':
    price += 100
if S[2] == 'o':
    price += 100

print(price)
from collections import Counter
n,m=map(int,input().split())
l=[]
for i in range(m):
  s=[]
  a,b=map(int,input().split())
  s.append(a)
  s.append(b)
  l.append(s)
def get_unique_list(seq):
    seen = []
    return [x for x in seq if (x or reversed(x)) not in seen and not seen.append(x)]
ls=get_unique_list(l)
cnt=Counter([x[0] for x in ls])
print(max(cnt.values())+1)


### FIXED CODE ###

n,m=map(int,input().split())
root=[-1]*n
def r(x):
  if root[x]<0:
    return x
  else:
    root[x]=r(root[x])
    return root[x]
def unite(x,y):
  x=r(x)
  y=r(y)
  if x==y:
    return
  root[x]+=root[y]
  root[y]=x
for i in range(m):
  a,b=map(int,input().split())
  a-=1
  b-=1
  unite(a,b)
ans=0
for i in range(n):
  ans=max(ans,-root[i])
print(ans)
n = int(input())
s = input()

# 3桁の番号を作るにあたり、文字列から抽出して作るのではなく、000〜999までの組み合わせが存在するかを確認する。
ans = 0
for i in range(10):
  a = s.find(str(i))
  for j in range(10):
    b = s.find(str(j), a+1) # aの取得位置の次から検索を行う
    for k in range(10):
      c = s.find(str(k), b+1)　# bの取得位置の次から検索を行う
      if a == -1 or b == -1 or c == -1: continue
      else: ans += 1
print(ans)

### FIXED CODE ###

n = int(input())
s = input()

# 3桁の番号を作るにあたり、文字列から抽出して作るのではなく、000〜999までの組み合わせが存在するかを確認する。
ans = 0
for i in range(10):
  a = s.find(str(i))
  for j in range(10):
    b = s.find(str(j), a+1) # aの取得位置の次から検索を行う
    for k in range(10):
      c = s.find(str(k), b+1) # bの取得位置の次から検索を行う
      if a == -1 or b == -1 or c == -1: continue
      else: ans += 1
print(ans)
a, b = map(int, input().split())
if ((a*b) % 2) == 1
	print("Odd")
else
	print("Even")


### FIXED CODE ###

a, b = map(int, input().split())
if (((a*b) % 2) == 1):
	print("Odd")
else:
	print("Even")
R = raw_input()
G = raw_input()
print(2*G - R)

### FIXED CODE ###

R = input()
G = input()
print(2*G - R)
print(max(int(input())-t, 0))

### FIXED CODE ###

x, t = map(int, input().split())
print(max(x-t, 0))
#! /usr/bin/env python3

import sys
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

N = int(readline())
XYP = [list(map(int, readline().split())) for _ in range(N)]

x_cost = [0] * ((1 << N) * N)
y_cost = [0] * ((1 << N) * N)

for bit in range(1 << N):
    for i, (xi, yi, _) in enumerate(XYP):
        x_cost[bit * N + i] = abs(xi)
        y_cost[bit * N + i] = abs(yi)

        for k, (xk, yk, _) in enumerate(XYP):
            if bit & (1 << k):
                x_cost[bit * N + i] = min(x_cost[bit * N + i], abs(xi - xk))
                y_cost[bit * N + i] = min(y_cost[bit * N + i], abs(yi - yk))

ans = [sys.maxsize for _ in range(N + 1)]

for bit in range(1 << N):
    cnt = bin(bit).count('1')
    bit_ = bit
    while bit_ >= 0:
        bit_ &= bit
        cost = 0
        for k in range(N):
            cost += 1 * XYP[k][2] * min(x_cost[bit_ * N + k],
                                        y_cost[(bit - bit_) * N + k])
        ans[cnt] = min(ans[cnt], cost)

        bit_ -= 1
for i in range(N + 1):
    print(ans[i])

### FIXED CODE ###

#! /usr/bin/env python3

import sys
import numpy as np
int1 = lambda x: int(x) - 1
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(500000)

X = int(readline())

if X <= 599:
    print(8)
elif X <= 799:
    print(7)
elif X <= 999:
    print(6)
elif X <= 1199:
    print(5)
elif X <= 1399:
    print(4)
elif X <= 1599:
    print(3)
elif X <= 1799:
    print(2)
elif X <= 1999:
    print(1)
h,w=map(int,input().split())
a=[]
for i in range(h)
a.append(input().split())

for i in range(h)
print(" ".join(a[i]))
print(" ".join(a[i]))

### FIXED CODE ###

h,w=map(int,input().split())
a=[]
for i in range(h):
   a.append(input().split())

for i in range(h):
   print(" ".join(a[i]))
   print(" ".join(a[i]))
n = int(input())
x＝list(map(int, input().split()))
for i in range(n-1):
  if x[i]>x[i+1]:
    x[i]-=1
for j in range(n-1):
  if x[j]>x[j+1]:
    print("No")
    exit()
print("Yes")
  

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
m = 0
for i in range(n):
  m = max(m,a[i])
  if a[i] < m-1:
    print("No")
    exit()
print("Yes")
n = int(input())
m = int(input())
print(n+m-1)

### FIXED CODE ###

n,m = map(int,input().split())
print((n-1)*(m-1))
W,H,x,y,r = raw_input()
W,H,x,y,r = map(int,(W,H,x,y,r))
def isXok(W,H,x,y,r):
    if x-r<0 or x+r>W:
        return False
    else:
        return True
def isYok(W,H,x,y,r):
    if y-r<0 or y+r>H:
        return False
    else:
        return True
if isXok(W,H,x,y,r) and isXok(W,H,x,y,r):
    print True
else:
    print False

### FIXED CODE ###

W,H,x,y,r = raw_input().split()
W,H,x,y,r = map(int,(W,H,x,y,r))
def isXok(W,H,x,y,r):
    if x-r<0 or x+r>W:
        return False
    else:
        return True
def isYok(W,H,x,y,r):
    if y-r<0 or y+r>H:
        return False
    else:
        return True
if isXok(W,H,x,y,r) and isYok(W,H,x,y,r):
    print "Yes"
else:
    print "No"
h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
ans = 'Yes'
for j in range(w):
  for i in range(h):
    ok = False
    if s[j][i] == '#':
      if j-1>=0:
        if s[j-1][i] == '#': ok = True
      if i-1>=0:
        if s[j][i-1] == '#': ok = True
      if j+1<w:
        if s[j+1][i] == '#': ok = True
      if i+1<h:
        if s[j][i+1] == '#': ok = True
      if ok == False:
        print('No')
        exit()
print(ans)

### FIXED CODE ###

h, w = map(int, input().split())
s = [list(input()) for j in range(h)]
ans = 'Yes'
for j in range(h):
  for i in range(w):
    ok = False
    if s[j][i] == '#':
      if j-1>=0:
        if s[j-1][i] == '#': ok = True
      if i-1>=0:
        if s[j][i-1] == '#': ok = True
      if j+1<h:
        if s[j+1][i] == '#': ok = True
      if i+1<w:
        if s[j][i+1] == '#': ok = True
      if ok == False:
        print('No')
        exit()
print(ans)
n = int(input())
a = [int(i) for i in input().split()]
count = 0
while all(i % 2 == 0 for i in a):
    a = [i/2 for i in a]
    count += 1
print(count)

### FIXED CODE ###

list=str(input())
print(list.count("1"))
n = input()
if n.count("7")>0:
  print("Yes")
  else:
    print("No")

### FIXED CODE ###

# for #!/usr/bin/env python
import os
import sys
from io import BytesIO, IOBase


def main():
	# for t in range(int(input())):
		n = input()
		if n.count("7")>0:
			print("Yes")
		else:
			print("No")
		
		


# region fastio

BUFSIZE = 8192


class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b"\n") + (not b)
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			self.buffer.truncate(0), self.buffer.seek(0)


class IOWrapper(IOBase):
	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode("ascii"))
		self.read = lambda: self.buffer.read().decode("ascii")
		self.readline = lambda: self.buffer.readline().decode("ascii")


sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# endregion

if __name__ == "__main__":
	main()
n = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans = ans*i
        if ans > 1000000000000000000 and i !== 0:
            print(-1)
            ans = -1
            break
    if ans != -1:
        print(ans)


### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
if 0 in a:
    print(0)
else:
    ans = 1
    for i in a:
        ans = ans*i
        if ans > 1000000000000000000:
            print(-1)
            ans = -1
            break
    if ans != -1:
        print(ans)
x = input()
d = 0
for i in range(1, 10 ** 6):
  d += i
  if x <= d:
    print(i)
    break




### FIXED CODE ###

x = int(input())
d = 0
for i in range(1, 10 ** 6):
    d += i
    if x <= d:
        print(i)
        break
a, b, c = map(int(), input().split())
print(a +' '+b+' '+c)


### FIXED CODE ###

a, b, c = input().split()
print(c +' '+a+' '+b)
import math
def AGC017C(a,f):
    p=0
    for i in range(f,a,2):
        p+=math.factorial(a)//math.factorial(a-i)//math.factorial(i)
    return p

n,p=map(int,input().split())
d={1:0,0:0}
a=list(map(int,input().split()))
for i in a:
    d[i%2]+=1
if p==0:
    print((2**d[0])*AGC017C(d[1]),0)
else:
    if d[1]==0:
        print(0)
    else:
        print((2**d[0])*(AGC017C(d[1],1)))

### FIXED CODE ###

import math
def AGC017C(a,f):
    p=0
    for i in range(f,a+1,2):
        p+=math.factorial(a)//math.factorial(a-i)//math.factorial(i)
    return p

n,p=map(int,input().split())
d={1:0,0:0}
a=list(map(int,input().split()))
for i in a:
    d[i%2]+=1
if p==0:
    print((2**d[0])*AGC017C(d[1],0))
else:
    if d[1]==0:
        print(0)
    else:
        print((2**d[0])*(AGC017C(d[1],1)))
x=int(iput())
if x==3 or x==5 or x==7:
    print("Yes")
else:
    print("No")


### FIXED CODE ###

x=int(input())
if x==3 or x==5 or x==7:
    print("YES")
else:
    print("NO")
n = input()
if n="A":
  print("T")
elif n="T":
  print("A")
elif n="G":
  print("C")
else:
  print("G")

### FIXED CODE ###

n = input()
if n=="A":
  print("T")
elif n=="T":
  print("A")
elif n=="G":
  print("C")
else:
  print("G")
n = int(input())
i = [int(input()) for i in range(n)]
j = 0
k = 0

if 1 not in a:
    print(-1)
else:   
    for i in range(1,n+1):
        if i in a[k:]:
            j = j + 1
            k = a[k:].index(i) + k
        else:
            break
    print(n-j)

### FIXED CODE ###

n = int(input())
a = list(map(int,input().split()))
x = 1
ans = 0

for i in a:
    if i == x:
        ans += 1
        x += 1

if ans == 0:
    print(-1)
else:
    print(len(a)-ans)