peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
_,s=open(0);t=s
p,q=o="()"
while o in s:s=s.replace(o,"")
f=s.count
print(p*f(q)+t+q*f(p))
# Judge status: Accepted
w,h,n = map(int,input().split())
x0,y0 = 0,0

for i in range(n):
    x,y,a = map(int,input().split())
    if a==1:
        x0=max(x0,x)
    elif a==2:
        w=min(w,x)
    elif a==3:
        y0=max(y0,y)
    else:
        h=min(h,y)
print(0 if w-x0<=0 or h-y0<=0 else (w-x0)*(h-y0))
# Judge status: Wrong Answer
A=int(input())
B=int(input())
c=[1,2,3]
c.remove(A)
c.remove(B)
print(c)
# Judge status: Accepted
N,M=map(int,input().split())

ans=dict()
AC=0
WA=0

for i in range(M):
    P,S= map(str,input().split())
    if((P in ans)==False):
        ans[P]=[S]
    else:
        ans[P].append(S)

for i in ans.values():
    tmp=0
    for value in i:
        if(value=='AC'):
            AC+=1
            WA+=tmp
            break
        else:
            tmp+=1
print(AC,WA)
# Judge status: Accepted
a, b, c = map(int, input().split())

total = a + b + c

if a % 2 == 0 and b % 2 == 0 and c % 2 == 0 and a == b == c:
    print(-1)
elif a % 2 != 0 or b % 2 != 0 or c % 2 != 0:
    print(0)
else:
    count = 1
    while True:
        a, b = (total - a) / 2, (total - b) / 2
        if a % 2 != 0 or b % 2 != 0:
            print(count)
            break
        else:
            count += 1
# Judge status: Wrong Answer
N,M,K = map(int,input().split())


for i in range(1,N+1):
    for j in range(1,M+1):
        count = i*M+j*N-2*i*j
        if count == K:
            print('Yes')
            exit()
print('No')
# Judge status: Accepted
#!/usr/local/bin python
# -*- coding: utf-8 -*-
#
# ~/PycharmProjects/atcoder/A-MaximizeTheFormula.py
#
a, b, c = map(int, input().split())
if a >= b and a >= c:
    print(10 * a + b + c)
elif b >= a and b >= c:
    print(a + 10 * b + c)
else:
    print(a + b + 10 * c)
# Judge status: Accepted
n = int(input())
w = [input() for _ in range(n)]
if len(w) != len(set(w)):
    print('No')
    exit()
for i in range(n-1):
    if w[i][-1] != w[i+1][0]:
        print('No')
        exit()
print('Yes')
# Judge status: Wrong Answer
a,b=map(int,input().split())
if a<b:
  print("Bob")
elif a>b:
  print("Alice")
else:
  print("Draw")
# Judge status: Accepted
K = int(input())
S = input()

if len(S) <= K:
    print(S)
else:
    print(S[0:K] + "...")
# Judge status: Accepted
N = int(input())
print(N//2) if((N % 2) == 0) else print(N//2 + 1)
# Judge status: Wrong Answer
import math
N = int(input())
Cap = [int(input()) for X in range(0,5)]
MIN = Cap.index(min(Cap))
if MIN==0: print(int(math.ceil(N/Cap[0])+4))
else: print(int(math.ceil(N/Cap[0])+math.ceil(Cap[MIN-1]/Cap[MIN])+3))
# Judge status: Accepted
S = input()
T = input()
for k in range(len(S)-len(T),-1,-1):
    f = 1
    for i in range(len(T)):
        if S[k+i] != "?" and S[k+i] != T[i]:
            f = 0
            break
    if f == 1:
        print(S[:k].replace("?","a")+T+S[k+len(T):].replace("?","a"))
        exit(0)
print("UNRESTORABLE")
# Judge status: Accepted
S = input().strip()
T = input().strip()
count = 0
for i in range(len(S)):
  if S[i] != T[i]:
    count += 1
print(count)
# Judge status: Wrong Answer
A = list(input())
B = list(input())
C = list(input())

A = A[::-1]
B = B[::-1]
C = C[::-1]

next = A.pop()

while 1:
  if len(A)==0:
    print('A')
    break
  elif len(B)==0:
    print('B')
    break
  elif len(C)==0:
    print('C')
    break
    
  if next=='a':
    next = A.pop()
  elif next=='b':
    next = B.pop()
  else:
    next = C.pop()
# Judge status: Accepted
x = int(input())
count = x//11
if x%11 == 0:
    print(count*2)
elif count*11+6 >= x:
    print(count*2+1)
else:
    print(count*2+2)
# Judge status: Wrong Answer
A,B,C=map(int,input().split())
if "AAB" or "ABA" or "BAA" or "AAC" or "ACA" or "CAA" or "BBA" or "BAB" or "ABB" or "CCA" or "CAC" or "ACC" or "BBC" or "BCB" or "CBB" or "CCB" or "CBC" or "BCC":
    print("Yes")
if "AAA" or "BBB" or "CCC" or "ABC":
    print("No")
# Judge status: Accepted
n, m = map(int, input().split())

A = 0
B = 1
cnt = [0] * (n+1)
ab = []

for i in range(m):
    a,b = map(int, input().split())
    ab.append([a, b])
    if a == 1:
        cnt[b] += 1
    elif b == n:
        cnt[a] += 1

for i in range(n+1):
    if cnt[i] == 2:
        print("POSSIBLE")
        exit()

print("IMPOSSIBLE")
# Judge status: Accepted
import sys, math
from functools import lru_cache
from collections import deque
sys.setrecursionlimit(10**9)
MOD = 10**9+7

def input():
    return sys.stdin.readline()[:-1]

def mi():
    return map(int, input().split())

def ii():
    return int(input())

def i2(n):
    tmp = [list(mi()) for i in range(n)]
    return [list(i) for i in zip(*tmp)]

S = input()
i = 1
r = len(S)
while True:
    if i >= len(S):
        break
    if S[i] == S[i-1]:
        r -= 1
        i += 2
    i += 1

print(r)
# Judge status: Accepted
s = int(input())
l = [s]
x = 1
y = 0

while y == 0:
  if s%2 == 0:
    s = int(s//2)
  else:
    s = 3*s+1

  if s in l:
    print(x+1)
    y = 1
  else:
    l.append(s)
    x += 1
# Judge status: Accepted
from string import ascii_lowercase
s = input()
k = int(input())

def main(s, k):
    alp = ascii_lowercase
    num = {char: i for i, char in enumerate(alp)}

    ns = [num[char] for char in s]

    for i in range(len(ns)):
        v = ns[i]
        if v != 0 and 26 - v <= k:
            ns[i] = 0
            k -= 26 - v

    ns[-1] = (ns[-1] + k) % 26

    return ''.join(alp[n] for n in ns)
print(main(s, k))
# Judge status: Accepted
a,b=map(int,input().split())
if abs(a-b)%2==0:
    print(min(a,b)+abs(a-b)//2)
else:
    print('IMPOSSIBLE')
# Judge status: Wrong Answer
from collections import Counter
n=int(input())
s_=input()
s=Counter(s_)
rgb = s['R'] * s['G'] * s['B']
cnt=0
for i in range(len(s_)):
  for j in range(i+1,len(s_)):
    h=j-i+j
    if h<len(s_)-1:
      if s_[i]!=s_[j] and s_[h]!=s_[j] and s_[i]!=s_[h]:
        cnt+=1

print(rgb-cnt)
# Judge status: Wrong Answer
n=int(input())
l=list(map(int,input().split()))

if n==1:
  print(1)
  exit()
  
cnt=0

if l[0]>l[1]:
  ans="low"
elif l[0]<l[1]:
  ans="high"
else:
  ans="even"
  
for i in range(2,n):
  if l[i-1]>l[i] and (ans=="low" or ans=="even"):
    ans="low"
  elif l[i-1]<l[i] and (ans=="high" or ans=="even"):
    ans="high"
  elif l[i-1]==l[i]:
    ans="even"
  else:
    cnt+=1
    ans="even"
    
print(cnt+1)
# Judge status: Wrong Answer
n=int(input())
s=[]
for i in range(n):
  s.append(input().split())

spoint=sorted(s,key=lambda x:x[1], reverse=True)
scity=sorted(spoint,key=lambda x:x[0])
print(scity)
# Judge status: Accepted
def main():
	arr =[]
	for i in range(int(input())):
		arr.append(int(input()))
	ans = 0
	now = 0
# (arr[i]+arr[i+1])//2 >= (arr[i]/2)+(arr[i+1]/2)
	for i in arr:
		if i==0:
			ans = ans +(now//2)
			now = 0
		else:
			now = now+i
	ans= ans+(now//2)
	print(ans)
if __name__ =="__main__":
	main()
# Judge status: Wrong Answer
s = input()

f = (0 < int(s[:2]) < 12)
s = (0 < int(s[2:]) < 12)
ans = 'NA'
if f:
    ans = 'YYMM'
elif s:
    ans = 'MMYY'
elif f and s:
    ans = 'AMBIGUOUS'
print(ans)
# Judge status: Accepted
n=int(input())

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

tmp=[]

for i in range(n):
    if i%2==1:
        continue
    x=a[i]^a[i+1]
    tmp.append(x)

S=0
for j in range(len(tmp)):
    S = S^tmp[j]

ans=[]

for k in range(n):
    p = a[k]^S
    ans.append(p)

print(*ans)
# Judge status: Accepted
N,W=map(int,input().split())
w=[]
v=[]
for i in range(N):
    ww,vv=map(int,input().split())
    w.append(ww)
    v.append(vv)

dp=[[0 for i in range(W+1)] for j in range(N+1)]

for i in range(N):
    for j in range(W+1):
        if(j-w[i]>=0):
            dp[i+1][j]=max(dp[i+1][j],dp[i][j-w[i]]+v[i])
        dp[i+1][j]=max(dp[i+1][j],dp[i][j])
print(dp[N][W])
# Judge status: Accepted
import re

s = input().replace('?', '.')
t = input()

for i in range(len(s)-len(t), -1, -1):
    if re.match(s[i:i+len(t):], t):
        s = s.replace('.', 'a')
        print(s[:i:]+t+s[i+len(t)::])
        exit()
print('UNRESTORABLE')
# Judge status: Accepted
import math
num = int(input())
num_list = list(map(int,input().split()))
ans = sum(num_list)/2
#numl = sum(num_list[:num//2])
#numr = sum(num_list[num//2:num])
#print(ans,numl,numr)
total = 0
flag = "off"
for i in range(num):
  total += num_list[i]
  if total >= ans:
    #print(ans)
    if ans -(total - num_list[i]) < total - ans:
      ans = ans -(total - num_list[i])
    else:
      ans = total - ans     
    break
#print(n1,n2)
#print(min((n2-ans),(ans-n1)))
print(math.ceil(ans*2))
# Judge status: Accepted
n,k=map(int,input().split())
a=list(map(int,input().split()))

l=0
r=1e9+5

while l+1!=r:
    m = (l+r)//2
    cnt = 0
    for x in a:
        cnt += (x-1)//m
    if cnt <= k:
        r = m
    else:
        l = m
print(int(r))
# Judge status: Accepted
n = int(input())

dp = [n]*100010
dp[0] = 0
pow69 = [6**i for i in range(1,7)] + [9**i for i in range(1,6)]

for i in range(1,n+1):
    dp[i] = dp[i-1] + 1
    for p in pow69:
        dp[i] = min(dp[i],dp[i-p]+1)

print(dp[n])
# Judge status: Accepted
n = int(input())
f = lambda c : 'A' if c == 'Z' else chr(ord(c)+1)

for c in input():
  for _ in range(n):
    c = f(c)
  print(c, end='')
print()
# Judge status: Wrong Answer
import math

def combinations_count(n, r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))
n,a,b=map(int,input().split())
sum=0
for i in range(n):
    if(i!=a or i!=b):
        tmp=combinations_count(n,i)
        sum+=tmp
result= sum%(10**9+7)
print(result)
# Judge status: Accepted
S=input()
N=len(S)

if S!=S[::-1]:
    print("No")
elif S[:(N-1)//2]!=S[(N-1)//2-1::-1]:
    print("No")
elif S[(N+3)//2-1:]!=S[:(N-1)//2:-1]:
    print("No")
else:
    print("Yes")
# Judge status: Accepted
a,b = map(int, input().split())

if a==1:
  a=14
if b==1:
  b=14

if a>b:
  print('Alice')
elif a<b:
  print('Bob')
else:
  print('Draw')
# Judge status: Wrong Answer
A, B, C, D = map(int, input().split())

T_HP = A
T_AT = B
A_HP = C
A_AT = D
T_count = 0
A_count = 0

while T_HP >= 0:
    T_HP -= T_AT
    T_count += 1
while A_HP >= 0:
    A_HP -= A_AT
    A_count += 1

if T_count > A_count:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
import sys

readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
read = sys.stdin.buffer.read
sys.setrecursionlimit(10 ** 7)
INF = float('inf')

N = int(readline().rstrip())
pos = (0, 0)
used_time = 0
for _ in range(N):
    t, x, y = map(int, readline().split())
    cost = abs(pos[0] - x) + abs(pos[1] - y)
    available = t - used_time
    # print("cost: {}".format(cost))
    # print("available: {}".format(available))
    if cost > available or (cost - available) % 2 != 0:
        print('No')
        quit()
    used_time += t
    pos = (x, y)
print('Yes')
# Judge status: Accepted
N = int(input())
A  = [input() for _ in range(N)]
c0=A.count("AC")
c1=A.count("WA")
c2=A.count("TLE")
c3=A.count("RE")
print("AC x",c0)
print("WA x",c1)
print("TLE x",c2)
print("RE x",c3)
# Judge status: Accepted
X = list(map(int,input().split()))
X.sort()
ans = 0
a = X[2] - X[1]
ans += a
ans += (X[2] - (X[0] + a)) // 2
#print(ans)
if (X[2] - (X[0] + a)) % 2 == 1:
    ans += 2
print(ans)
# Judge status: Accepted
n,m=[int(x) for x in input().rstrip().split()]
l=[[] for x in range(n)]
for i in range(m):
  a,b=[int(x) for x in input().rstrip().split()]
  l[a-1].append(b-1)
  l[b-1].append(a-1)

done=[False for i in range(n)]
ans=[0 for i in range(n)]
def bfs():
  stack=[0]
  done[0]=True
  while(stack):
    now=stack.pop(0)
    done[now]=True
  
    for i in l[now]:
      if done[i]==True:
        continue
      ans[i]=now+1
      done[i]=True
      stack.append(i)

bfs()
print("Yes")
print(*ans[1:])
# Judge status: Accepted
n,h=map(int,input().split())
ab=[list(map(int,input().split())) for i in range(n)]
ab.sort(reverse=True,key=lambda x:x[1])

a_max=0
for a,b in ab:
  a_max=max(a,a_max)

cnt=0
damage=0
for a,b in ab:
  if damage>=h:
    print(cnt)
    exit()
  if b<=a_max:
    break

  cnt+=1
  damage+=b

zan=h-damage
cnt+=(zan+a_max-1)//a_max
print(cnt)
# Judge status: Wrong Answer
n = int(input())
slist = []
for i in range(n):
    news = str(input())
    slist.append(news)
# print(slist)
slist_u = list(set(slist))
print(slist_u)
slist_u_len = len(slist_u)
print(slist_u_len)
# Judge status: Accepted
n,m = map(int,input().split())
print(abs((n-2) * (m-2)))
# Judge status: Accepted
N, K = map(int, input().split())
p = list(map(int, input().split()))
print(sum(sorted(p)[:K]))
# Judge status: Accepted
n,a,b,c,d = map(int,input().split())
s = input()
S = s[:max(c,d)]
#print(S)
l = len(S)
C = True
D = False
for i in range(l-1):
  if i >= min(a,b) and S[i]=='#' and S[i+1]=='#':
    C = False
    break
  if c > d and d > i >= max(a,b)-1:
    if S[i-1]=='.' and S[i]=='.' and S[i+1]=='.':
      D = True
      
if not C:
  print('No')
elif C and not D:
  if c < d:
    print('Yes')
  else:
    print('No')
else:
  print('Yes')
# Judge status: Accepted
# 幅優先探索
from collections import deque

N, M = map(int, input().split())
AB = [map(int, input().split()) for _ in range(M)]

links = [[] for _ in range(N + 1)]
for a, b in AB:
    links[a].append(b)
    links[b].append(a)

result = [-1] * (N + 1)
q = deque([1])
while q:
    i = q.popleft()
    for j in links[i]:
        if result[j] == -1:
            result[j] = i
            q.append(j)
print('Yes')
print(*result[2:], sep='\n')
# Judge status: Accepted
import collections
n,k = map(int,input().split())
a = list(map(int,input().split()))
c = sorted(list(collections.Counter(a).values()),reverse=True)
print(sum(c[k:]))
# Judge status: Accepted
n = int(input())
s = input()
res = 0
tem = s.find('WR')
if tem == -1:
    print(res)
else:
    i, j = 0, len(s)-1
    while i<j:
        while i < j and s[i] != 'W': i+=1
        while i < j and s[j] != 'R':j -= 1
        if s[i] == 'W' and s[j] == 'R':
            res += 1
            i += 1
            j -= 1
    print(res)
# Judge status: Accepted
N=int(input())
a=list(map(int,input().split()))

ans=0
for i in range(0,N,2):
    if a[i]%2==1:
        ans+=1
print(ans)
# Judge status: Wrong Answer
s = str(input())

ans = 0

def kaibun(tex):
  n = len(tex)
  before = tex[0:int((n-1)/2)]
  after = tex[int((n+3)/2-1):]
  if before == before[::-1] and after == after[::-1]:
    return 1
  else:
    return 0

ans += kaibun(s)

before = s[0:int((len(s)-1)/2)]
after = s[int((len(s)+3)/2-1):]

if ans == 1 and after == after[::-1] and before == before[::-1]:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
n = int(input())
lis = [input() for _ in range(n)]

ans = ""

for i in "abcdefghijklmnopqrstuvexyz":
    mn = 50
    for j in lis:
        mn = min(mn,j.count(i))

    ans += i*mn
    
print(ans)
# Judge status: Wrong Answer
n = int(input())
l = list(map(int, input().split()))
ogya = []

if n%2==0:
	for i in range (0, n):
		if i%2==0:
			ogya.insert(0, l[i])
		else:
			ogya.append(l[i])
else:
	for i in range (0, n):
		if i%2==0:
			ogya.append(l[i])
		else:
			ogya.insert(0, l[i])

print(*ogya)
# Judge status: Accepted
s=input()
print('AC' if s[0]=='A' and s[2:-1].count('C')==1 and s[1].islower() and s[1:].replace('C','',1).islower() else 'WA')
# Judge status: Wrong Answer
S = list(input())
n = len(S)

s1 = 0
s2 = 0

for i, j in enumerate(S):
    if i%2 == 0:
        if j == '1':
            s1 += 1
        else:
            s2 += 1
    else:
        if j == '0':
            s2 += 1
        else:
            s1 += 1
print(min(s1, s2))
# Judge status: Accepted
A,B,C=map(int,input().split())
M=[A,B,C]
M.sort()
kaisuu1=M[2]-M[1]
M[0]+=kaisuu1
M[1]+=kaisuu1
nokori=M[1]-M[0]
q,r=divmod(nokori,2)
sum_kaisuu=kaisuu1+q
if r==1:
    sum_kaisuu+=2
print(sum_kaisuu)
# Judge status: Accepted
import itertools

antenna = [int(input()) for _ in range(6)]
distance = antenna.pop()
flag = True
for i in itertools.combinations(antenna, 2):
    if abs(i[0] - i[1]) > distance:
        print(':(')
        flag = False
        break
if flag:
    print('Yay!')
# Judge status: Wrong Answer
N = int(input())

list_ = list()

for i in range(N):
  X,L = map(int,input().split())
  max_ = min(10**9,X+L)
  min_ = max(0,X-L+1)
  list_.append((X,min_,max_))
list_.sort()

d = 0
nowmax = -1
nowmin = -1

for x, min_, max_ in list_:
  if nowmax >= min_:
    d += 1
    if nowmin >= min_:
      pass
    elif nowmax <= max_:
      pass
    else:
      nowmin = min_
      nowmax = max_
  else:
    nowmin = min_
    nowmax = max_
  
print(N-d)
# Judge status: Wrong Answer
x = int(input())
 
if x > 11:
    if x % 11 > 6:
        ans = x // 11 * 2 + 2
    else:
        ans = x // 11 * 2 + 1
else:
    if x % 11 > 6:
        ans = 2
    else:
        ans = 1

print(ans)
# Judge status: Wrong Answer
a,b,c = map(int,input().split())
print(b,c,a)
# Judge status: Accepted
N,K = map(int,input().split())
for i in range(1,100000000):
    if K ** i > N:
        print(i)
        break
# Judge status: Wrong Answer
S = str(input())
x = len(S)
if S[0] == '1':
    while '10' in S:
        S = S.replace('10', '')
    S = S.replace('01', '')
else:
    while '01' in S:
        S = S.replace('01', '')
    S = S.replace('10', '')

print(x - len(S))
# Judge status: Accepted
a,b,c,k=map(int,input().split())
if k%2==0:
  print(a-b)
else:
  print(b-a)
# Judge status: Accepted
n, m, q = map(int, input().split())
a = []
for _ in range(q):
    a.append(list(map(int, input().split())))

import itertools

List = []
for v in itertools.combinations_with_replacement(range(1, m+1), n):
    List.append(list(v))
    
answer = []
for l in List:
    ans = 0
    for j in a:
        if l[j[1]-1] - l[j[0]-1] == j[2]:
            ans += j[3]
    answer.append(ans)
    
print(max(answer))
# Judge status: Accepted
n=int(input())
w=list(map(int,input().split()))
#w.sort()
ss=sum(w)
ans=10**9
cur=0
for i in range(n-1):
    cur+=w[i]
    ans=min(ans,abs(ss-2*cur))
print(ans)
# Judge status: Wrong Answer
def main():
    n, d = map(int, input().split())
    x = 1

    while True:
        monitoring = 2 * d * x

        if monitoring < n:
            x += 1
        else:
            break

    print(x)

if __name__ == '__main__':
    main()
# Judge status: Wrong Answer
a, b = map(float, input().split())
a = int(a)
from decimal import Decimal
from fractions import Fraction
import math
dc_b = Decimal.from_float(b)
print(math.floor(dc_b*a))
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
flg = 0
ans = 0
for i in range(1,n):
  if a[i] == a[i-1]:
    continue
  elif a[i] > a[i-1]:
    if flg == -1:
      ans += 1
      flg = 0
    else:
      flg = 1
  elif a[i] < a[i-1]:
    if flg == 1:
      ans += 1
      flg = 0
    else:
      flg = -1
print(ans+1)
# Judge status: Accepted
# D Knapsack 1

from collections import deque

n, w = map(int,input().split())
wv_list = deque([[int(x) for x in input().split()] for y in range(n)])

dp = [[float("-Inf")] * (w+1) for _ in range(n+1)]
dp[0] = [0]*(w+1)

for i in range(n):
    _w,_v = wv_list.popleft()
    for j in range(w+1):
        if j-_w < 0:
            dp[i+1][j] = dp[i][j]
        else:
            dp[i+1][j] = max(dp[i][j], dp[i][j-_w]+_v)

print(dp[n][w])
# Judge status: Accepted
N = int(input())

if N%2 == 0:
	print(int(N/2))
else:
	print(int(N/2) + 1)
# Judge status: Wrong Answer
N=int(input())
D=[int(i) for i in input().split()]
mid=N//2-1
print(D[mid+1]-D[mid])
# Judge status: Wrong Answer
import sys
def input(): return sys.stdin.readline().strip()
def mapint(): return map(int, input().split())
sys.setrecursionlimit(10**9)

N = int(input())
As = [-int(input()) for _ in range(N)]

from bisect import bisect_left
lis = [1]
for a in As:
    if a>=lis[-1]:
        lis.append(a)
    else:
        lis[bisect_left(lis, a)] = a

print(len(lis))
# Judge status: Accepted
n, k, q = map(int, input().split())
a = [int(input()) for _ in range(q)]
p = [0 for i in range(n)]
for a_ in a:
  p[a_ - 1] += 1
for p_ in p:
  if k - q + p_ <= 0:
    print('No')
  else:
    print('Yes')
# Judge status: Wrong Answer
N = str(input())
a, b, c, d = N[0], N[1], N[2], N[3]

ans = "No"
for i in range(4):
  a, b, c, d = b, c, d, a
  if a == b == c:
    ans = "Yes"
    
    
    
print(ans)
# Judge status: Accepted
#設定
import sys
input = sys.stdin.buffer.readline

#ライブラリインポート
from collections import defaultdict

#入力受け取り
def getlist():
	return list(map(int, input().split()))

#処理内容
def main():
	N = int(input())
	P = getlist()
	S = [0] * N
	S[0] = P[0]
	for i in range(1, N):
		S[i] = min(S[i - 1], P[i])
	# print(S)
	ans = 0
	for i in range(N):
		if S[i] >= P[i]:
			ans += 1
	print(ans)
	
if __name__ == '__main__':
	main()
# Judge status: Wrong Answer
import math
import collections
import fractions
import itertools

def solve():
    n, m = map(int, input().split())
    if n == m == 1:
        print(1)
    elif n == 1:
        print(m-2)
    elif n == m == 2:
        print(0)
    else:
        print((n-2)*(m-2))
    return 0

if __name__ == "__main__":
    solve()
# Judge status: Accepted
X, K, D = map(int, input().split())

sho = abs(X)//D
amari = abs(X) % D

if abs(X) > K * D:
    print(abs(X) - K*D)
    exit(0)

if sho % 2 == K % 2:
    print(amari)
else:
    print(D - amari)
# Judge status: Accepted
S = input()
ans = []
for s in S:
    if s == 'B':
        if len(ans) > 0:
            ans.pop(-1)
    else:
        ans.append(s)
print(''.join(ans))
# Judge status: Accepted
sx ,sy, tx, ty = map(int, input().split())

ans = ""

ans += "U" * (ty-sy) + "R" * (tx-sx)
ans += "D" * (ty-sy) + "L" * (tx-sx)

ans += "L" + "U" * (ty-sy+1) + "R" * (tx-sx+1) + "D"
ans += "R" + "D" * (ty-sy+1) + "L" * (tx-sx+1) + "U"

print(ans)
# Judge status: Accepted
ma = lambda :map(int,input().split())
n,m = ma()
tr = [[] for i in range(n)]
for i in range(m):
    a,b = ma()
    tr[a-1].append(b-1)
    tr[b-1].append(a-1)
f = False
for i in tr[0]:
    for s in tr[i]:
        if s==n-1:
            f =True
print("POSSIBLE") if f else print("IMPOSSIBLE")
# Judge status: Accepted
N = int(input())
res = set([0])
for _ in range(N):
    s = int(input())
    res |= set([r + s for r in res])
res = list(res)
res.sort()
n = len(res)
for i in range(n-1, -1, -1):
    if res[i] % 10 == 0:
        continue
    print(res[i])
    break
else:
    print(0)
# Judge status: Accepted
import sys
def input(): return sys.stdin.readline().rstrip()
from operator import itemgetter
def main():
    q,h,s,d=map(int,input().split())
    n=int(input())
    weight=[(0.25,q,q/0.25),(0.5,h,h/0.5),(1,s,s),(2,d,d/2)]
    weight.sort(key=itemgetter(2))
    cost=0
    for w in weight:
        kosu=n//w[0]
        cost+=int(w[1]*kosu)
        n-=w[0]*kosu
    print(cost)
if __name__=='__main__':
    main()
# Judge status: Accepted
A, B = map(int, input().split())
S = input()
ans = 'Yes'

for i, s in enumerate(S):
    if i == A:
        if s != '-':
            ans = 'No'
    if i != A:
        if s == '-':
            ans = 'No'

print(ans)
# Judge status: Accepted
n,T =map(int,input().split())
ans = 10**3+1
for i in range(n):
    c,t=map(int,input().split())
    if t > T:
        continue
    else:
        ans = min(ans,c)
if ans == 10**3+1:
    print('TLE')
else:
    print(ans)
# Judge status: Wrong Answer
N=int(input())
t_,x_,y_=(0,0,0)

ans = 'Yes'
for n in range(N):
    t,x,y = list(map(int,input().split()))
    T = t-t_
    manhattan_dist = abs(x-x_)+abs(y-y_)
    if T >= manhattan_dist and manhattan_dist%2 == T%2:
        pass
    else:
        ans='No'

print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())

X =a*10 + b + c
Y =b*10 + a + c
Z =c*10 + a + b
ans =max(X,Y,Z)
print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
flag = False
for i in range(1,b+1):
    if (a*i-c)%b==0:
        flag = True
print('YES' if flag==True else 'NO')
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))
B = list(map(int,input().split()))
total = 0
for i in range(N):
    if(A[i]<=B[i]):
        if(A[i+1]<= B[i] - A[i]):
            total+= A[i+1]+A[i]
            A[i+1]=0 
        else:
            A[i+1]-= B[i] - A[i]
            total += B[i]
    else:
        total += B[i]
print(total)
# Judge status: Accepted
N,K=map(int,input().split())
x=list(map(int,input().split()))

res=[]
for i in range(N-K+1):
  tmp = min(abs(x[i]),abs(x[i+K-1]))+x[i+K-1]-x[i]
  res.append(tmp)
  
print(min(res))