peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
n = int(input())

if (n == 1)or(n==0):
    print(0)
else:
    xn = n-2
    a10 = 2*10**xn

    if n != 2:
        a9 = (9**(n-2)*(n-1)*2)
    else:
        a9 = 0

    ans = (a10+a9)%((10**9)+7)
    print(ans)
# Judge status: Wrong Answer
n = int(input())
H = list(map(int,input().split()))
print ("Yes") if H[0] < H[-1] or n == 1 else print ("No")
# Judge status: Accepted
import itertools
def permutation_all(seq, choice):
    return list(itertools.permutations(seq, choice))

a = []
for i in range(5):
    a.append(int(input()))
p = permutation_all(a,5)
ans = 1000000000
for i in range(len(p)):
    point = p[i]
    tot = 0
    for j in range(5):
        if j != 4:
            tot += (point[j]+9)//10 * 10
        else:
            tot += point[j]
    ans = min(ans,tot)
print(ans)
# Judge status: Accepted
a, b, c, d = map(int, input().split())

l = c // b
if c % b !=0:
  l += 1
  
m = a // d
if a % d !=0:
  m += 1
  
if l == m:
  print("Yes")
elif l < m:
  print("Yes")
else:
  print("No")
# Judge status: Wrong Answer


n = int(input())

s = input()

now =0
right = 0
for i in range(n):
    if(s[n-1-i]=='('):
        now+=1
    else:
        now-=1
    if(right<now):
        right=now
left=0
for i in range(n):
    if(s[i]=='('):
        now-=1
    else:
        now+=1
    if(left<now):
        left=now

print('('*left +s+ ')'*right)
# Judge status: Accepted
def solve():
    n,m = map(int,input().split())
    a = tuple(map(int,input().split()))
    s = sum(a)
    level = (s+4*m-1)//(4*m)
    cnt = 0
    for i in a:
        if i>=level:
            cnt+=1
    if cnt>=m:
        print('Yes')
    else:
        print('No')
if __name__=='__main__':
    solve()
# Judge status: Accepted
M=10**9+7;x,y=map(int,input().split());d,m=divmod(x+y,3)
if m or y>2*x or x>2*y:print(0);exit()
x-=d;y-=d;s=t=1
for i in range(min(x,y)):s=s*(x+y-i)%M;t=t*(i+1)%M
print(s*pow(t,M-2,M)%M)
# Judge status: Accepted
n = int(input())
jobs = [list(map(int,input().split())) for i in range(n)]

time = 0
jobs.sort(key = lambda x:x[1])

result = 'Yes'

for job in jobs:
    time += job[0]
    if time > job[1]:
        result = 'No'
        break

print(result)
# Judge status: Wrong Answer
N, X, Y=map(int,input().split())
List=[]
i=1
for j in range(2,N+1):
  while 0<i<j<=N:
    List.append(min([abs(j-i), abs(X-i)+abs(Y-j)+1]))
    i+=1  
  else:
    j+=1  
    i=1
List.sort()

import collections
c=collections.Counter(List)
Newlist=list(c.values())
for p in Newlist:
  print(p)
# Judge status: Accepted
import bisect

N = int(input())
A = []
for i in range(N):
    a = int(input())
    A.append(a)

B = [A[-1]]
del A[-1]
for a in reversed(A):
    if B[-1] <= a:
        B.append(a)
    else:
        B[bisect.bisect_right(B,a)] = a
    # print(B)



print(len(B))
# Judge status: Accepted
N = int(input())

now = [0, 0]
for i in range(N):
    t, x, y = map(int, input().split())
    dist = abs(x - now[0]) + abs(y - now[1])
    if dist <= t and (t - dist) % 2 == 0:
        continue
    print('No')
    quit()
 
print('Yes')
# Judge status: Wrong Answer
N = int(input())
INF = 10 ** 9 + 7
if N < 2:
    print(0)
    exit()
print(pow(10, N, INF) - 2 * pow(9, N, INF) + pow(8, N, INF))
# Judge status: Accepted
X, Y, A, B, C = map(int, input().split())
*p, = map(int, input().split())
*q, = map(int, input().split())
*r, = map(int, input().split())

p.sort(reverse=True)
q.sort(reverse=True)

l = p[:X]+q[:Y]+r
l.sort(reverse=True)
print(sum(l[:X+Y]))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int,input().split()))

a_2 = [0 for i in range(n)]
for i in range(n):
    a_2[a[i]-1] += 1

al = [0 for i in range(n)]
c = 0
for i in a_2:
    if i > 1:
        al[c] += i * (i-1) / 2
    c += 1

for i in range(n):
    f = a[i]
    t = a_2[f-1] - 1
    #print(int(sum(al)-(al[f-1]-t*(t-1)/2)))
# Judge status: Accepted
S = input()
n = 0
w = 0
s = 0
e = 0

for i in range(len(S)):
    if S[i] == "N":
        n += 1
    elif S[i] == "W":
        w += 1
    elif S[i] == "S":
        s += 1
    else:
        e += 1
if n > 0 and w > 0 and s > 0 and e > 0:
    print("Yes")
elif n > 0 and s > 0 and w == 0 and e == 0:
    print("Yes")
elif w > 0 and e > 0 and s == 0 and n == 0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
N = int(input())
a = [''.join(sorted(list(input()))) for _ in range(N)]
import collections
c = collections.Counter(a)
c_ls = list(c.values())
ans = 0
for i in range(len(c_ls)):
  ans += c_ls[i] * (c_ls[i]-1)//2
print(ans)
# Judge status: Accepted
s=input()
res=[]
for i in range(len(s)-2):
    res += [abs(int(s[i:i+3])-753)]
print(min(res))
# Judge status: Wrong Answer
n=int(input())
plist=list(map(int,input().split()))

a=max(plist)
cnt=0

for p in plist:
    if p == plist[0]:
        a = p
        cnt +=1
    else:
        if p <= a:
            a = p
            cnt += 1

print(a)
# Judge status: Accepted
N = input()
if N[-4] == N[-3] and N[-2] == N[-1] : 
    print("Yes")
else :
    print("No")
# Judge status: Accepted
def L():
    return list(map(int, input().split()))

[x,y]=L()

if x%y==0:
  print(-1)
else:
  print(x)
# Judge status: Wrong Answer
n = int(input())
a = int(input())
print("Yes" if (n%500)<a else "No")
# Judge status: Wrong Answer
s=input()
ans=0
i=0
while i<3 and s[i]=='R':
    i+=1
    ans+=1
print(ans)
# Judge status: Accepted
A = input()

ans = 1<<60
for i in range(len(A)-2):
  x = A[i:i+3]
  ans = min(ans, abs(int(x) - 753))
print(ans)
# Judge status: Accepted
N = int(input())
S = input()

res = 0
for i in range(1, N):
    res = max(len(set(S[:i])&set(S[i:])), res)

print(res)
# Judge status: Accepted
N = int(input())

ans = 0
for i in range(2, N):
    if i * i > N:
        break
    e = 0
    while N % i == 0:
        e += 1
        N //= i
    if e > 0:
        for j in range(1, 10):
            if e >= j:
                e -= j
                ans += 1
            else:
                break
if N > 1:
    ans += 1

print(ans)
# Judge status: Accepted
S = input()

if len(S) % 2 > 0:
    print('No')
else:
    if S[0::2].count('h') == len(S) // 2 and S[1::2].count('i') == len(S) // 2:
        print('Yes')
    else:
        print('No')
# Judge status: Wrong Answer
h, w = map(int, input().split())

ans = 0
if h == 0 or w == 0:
    ans = 0
else:
    r, c = h//2, w//2
    ans = r * c
    if h%2 == 1:
        r = h//2  + 1

    if w%2 == 1:
        c = w//2 + 1

    ans += r * c

print(ans)
# Judge status: Accepted
a=int(input())
b=int(input())
c=int(input())
x=int(input())
ans=0

for i in range(a+1):
    for j in range(b+1):
        for k in range(c+1):
            tmp = 500*i+100*j+50*k
            if tmp==x:
                ans+=1

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

if(a == b and b == c and a % 2 == 0):
    print(-1)
else :
    cnt = 0
    while True:
        if(a % 2 != 0 or b % 2 != 0 or c % 2 != 0):
            break
        A = b//2 + c//2
        B = c//2 + a//2
        C = a//2 + b//2
        a = A
        b = B
        c = C
        cnt += 1
    print(cnt)
# Judge status: Wrong Answer
a, b, c = map(int, input().split())
k = int(input())
n = 0
if a+1 > b:
    i = 1
    while b*(2**i) < a+1:
        i += 1
    n += i
    #print(n,i)
if a+2 > c:
    i = 1
    while c*(2**i) < a+2:
        i += 1
    n += i
    #print(n,i)

if k >= n:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
taxed_price = int(input())
raw_price = taxed_price // 1.08

if int(raw_price * 1.08) == taxed_price:
    print(int(raw_price))
elif int((raw_price + 1) * 1.08) == taxed_price:
    print(int(raw_price + 1))
else:
    print(':(')
# Judge status: Wrong Answer
N,K=map(int,input().split())
listA=[0]*10**5
for z in range(N):
    a,b=map(int,input().split())
    listA[a-1]+=b

count=0
y=0
while count<10**5-1:
    y+=listA[count]
    if y>=K:
        print(count+1)
        break
    else:
        count+=1
# Judge status: Wrong Answer
N = int(input())
XL = [tuple(map(int,input().split())) for i in range(N)]
XL.sort(key=lambda x: x[0])
right = -float('inf')
ans = 0
for x,l in XL:
    s,t = x-l+1, x+l-1
    if s > right:
        right = t
        ans += 1
print(ans)
# Judge status: Accepted
def main():
    from itertools import product, zip_longest

    s = input()

    for prod in product(['+', '-'], repeat=3):
        formula = ''
        for x, op in zip_longest(s, prod, fillvalue=''):
            formula += x + op
        if eval(formula) == 7:
            print(formula + '=7')
            return


if __name__ == '__main__':
    main()
# Judge status: Accepted
n=[int(input()) for i in range(5)]
m=int(input())
if max(n)-min(n)>m:
    print(':(')
else:
    print('Yay!')
# Judge status: Wrong Answer
n,m = map(int,input().split())
left = 0
right = n
for i in range(m):
  l,r = map(int,input().split())
  left = max(left,l)
  right = min(right,r)
print(right-left+1)
# Judge status: Accepted
n = int(input())
a = list(map(int,input().split()))
m = 1000
stocks = 0
drops = [False]*(n-1)
for i in range(n-1):
    if a[i] > a[i+1]:
        drops[i] = True
for i in range(n-1):
    if drops[i]:
        m+=stocks*a[i]
        stocks = 0
    else:
        stocks+=m//a[i]
        m -= (m//a[i])*a[i]
print(m + stocks*a[-1])
# Judge status: Accepted
a, b = input().split()
ans = 'No'
for i in range(1000):
  if i*i == int(a+b):
    ans = 'Yes'
print(ans)
# Judge status: Accepted
S = str(input())
 
if S[2] == S[3] and S[4] == S[5]:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
N,M = map(int,input().split())
K = []
sum = 0
for i in range(N):
  W=list(map(int,input().split()))
  W.pop(0)
  K+=W
for T in range(1,len(K)+1):
  B=K.count(T)
  if B == N:
    sum+=1
print(sum)
# Judge status: Accepted
n=int(input())
ans=0
for i in range(1,n+1):
    up=n//i
    ans+=up*(up+1)*i//2
print(ans)
# Judge status: Accepted
n = int(input())

count_max = 0
count = 0
for i in range(n):
    d1, d2 = map(int, input().split())
    if d1 == d2:
        count += 1
        count_max = max(count_max, count)
    else:
        count = 0
print("Yes" if count_max >= 3 else "No")
# Judge status: Accepted
a, b = map(str, input().split())
c = int(a + b)

if (c ** .5).is_integer():
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))
for i in range(N):
  A[i] -= i + 1
m = min(A)
for i in range(N):
  A[i] -= m
g = sum(A) // N
print(min(sum(abs(i - g + 1) for i in A), sum(abs(i - g) for i in A), sum(abs(i - g - 1) for i in A)))
# Judge status: Accepted
S = input()

if S[0] == S[1] or S[1] == S[2] or S[2] == S[3] :
    print("Bad")
else :
    print("Good")
# Judge status: Accepted
import fractions
A, B = map(int, input().split())
print((A * B) // fractions.gcd(A, B))
# Judge status: Accepted
import numpy as np

c = [list(map(int,input().split())) for i in range(3)]
c = np.array(c)
flg = True

for i in range(2):
    if not c[0,i]-c[0,i+1] == c[1,i]-c[1,i+1] == c[2,i]-c[2,i+1]:
        flg = False
        break
    if not c[i,0]-c[i+1,0] == c[i,1]-c[i+1,1] == c[i,2]-c[i+1,2]:
        flg = False
        break
print('Yes') if flg else print('No')
# Judge status: Wrong Answer
N,A,B = map(int,input().split())
if (A - B) % 2 == 0:
	print(int((B - A)/2))
else:
	print(min(A - 1,N - B) + 1 + (B - A - 1)//2)
# Judge status: Accepted
from collections import Counter

n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
base = 0
for i in c.values():
    base += i*(i-1)//2

ans = []
for ai in a:
    k = c[ai]
    tmp = base - k*(k-1)//2 + (k-1)*(k-2)//2
    ans.append(tmp)

print(*ans, sep="\n")
# Judge status: Accepted
N = int(input())
list_A1 = [int(x) for x in input().split()]
list_A2 = [int(x) for x in input().split()]

ans = 0

for i in range(N) :
    total = sum(list_A1[:i+1]) + sum(list_A2[i:])
    ans = max(ans, total)

print(ans)
# Judge status: Wrong Answer
x=input()
list1=[]
for o in list(x):
  if o!=x:
    list1.append(x)
  else:
    list1.append(x)
str="".join(list1)
print(str)
# Judge status: Accepted
n = int(input())
s = input()
dp_L = [0]*(n+1)
dp_R = [0]*(n+1)

for i in range(n):
    dp_L[i+1] = dp_L[i]+[0, 1][s[i] == 'W']

for i in reversed(range(n)):
    dp_R[i] = dp_R[i+1]+[0, 1][s[i] == 'E']
    
print(min(L+R for L, R in zip(dp_L, dp_R)))
# Judge status: Wrong Answer
import itertools
n = int(input())
a = [int(i) for i in input().split()]
b = [int(i) for i in input().split()]

l = list(itertools.permutations(range(1,n+1)))

A, B = 0, 0
for i, p in enumerate(l):
    if p == a:
        A = i
    if p == b:
        B = i

print(abs(A-B))
# Judge status: Accepted
# ABC131A

s = input()
if s[0] == s[1] or s[1] == s[2] or s[2] == s[3]:
    print('Bad')
else:
    print('Good')
# Judge status: Accepted
a=int(input())
if a%2==0:
  print(0.5)
else:
  print((a+1)/2/a)
# Judge status: Wrong Answer
N, M = map(int,input().split())

if N == 1 and M == 1:
    print(1)
elif N == 1 and M != 1:
    print(M-2)
else:
    print((N-2)*(M-2))
# Judge status: Wrong Answer
s=input()
ans=0
if s[1]=="S":
    if s[0]=="R" or s[2]=="R":
        print(1)
    else:
        print(0)
else:
    if s[0]!="R" or s[2]!="R":
        print(2)
    else:
        print(3)
# Judge status: Accepted
a,b,c = map(int,input().split())

if (10*b + c) % 4 == 0:
  print("YES")
  
else: 
  print("NO")
# Judge status: Accepted
#ABC045 A
a,b,h = [int(input()) for i in range(3)]
print((a+b)*h//2)
# Judge status: Accepted
(h, n), *m = [[*map(int, i.split())] for i in open(0)]
dp = [0] + [10**9] * h
for i in range(1, h + 1):
    for a, b in m:
        dp[i] = min(dp[i], dp[max(i-a,0)]+b)
print(dp[-1])
# Judge status: Wrong Answer
n = int(input())
l = list(input().split())
#print(l)

x = []
for i in range(len(l)):
    j = str(l[i]) + str(i+1)
    x.append(j)
#print(x)
x.sort()
#print(x)
for k in x:
    print(k[1], end = ' ')
# Judge status: Accepted
# Problem C - When I hit my pocket...

import math

# input
K, A, B = map(int, input().split())

# initialization
koho_1 = 1 + K
koho_2 = 0
if B-A>2:
    koho_2 = A
    K -= A - 1
    if K%2==1:
        koho_2 += 1
        K -= 1
    koho_2 += (B - A) * (K // 2)

# calc
ans = max(koho_1, koho_2)

# output
print(ans)
# Judge status: Accepted
if input() in list('aeiou'):
    print('vowel')
else:
    print('consonant')
# Judge status: Wrong Answer
N = int(input())
D = []
for i in range(N):
    x, l = map(int, input().split())
    D.append([x-l, x+l])
from operator import itemgetter
D = sorted(D, key = itemgetter(0))
u = -10**10 #最小値:x = 0, l = 10**10の時
cnt = 0
for a, b in D:
    if u < a:
       cnt += 1
       u = b #つぎのロボットの範囲の下限に置きかえる
print(cnt)
# Judge status: Accepted
n = int(input())
x = list(map(int, input().split()))
s = sorted(x)
for i in x:
  if i < s[n // 2]:
    print(s[n // 2])
  else:
    print(s[n // 2 - 1])
# Judge status: Wrong Answer
x=int(input())
x-=(x//500)*500
y=x//5
print((x//500)*1000+5*y)
# Judge status: Accepted
n, a, b = map(int, input().split())

if n%(a+b) >a:
    print(int(n//(a+b))*a +a)
else:
    print(int(n//(a+b))*a +n%(a+b))
# Judge status: Accepted
K,A,B = map(int,input().split())
if B-A <= 2:
    print(1+K)
    exit()
time = K - A + 1
print(A + time//2*(B-A) + time%2)
# Judge status: Wrong Answer
a,b=map(int,input().split())
if min(a,b)==1:
  print(max(a,b)-2)
else:
  print((a-2)*(b-2))
# Judge status: Accepted
N, M, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))

a = [0]
b = [0]
T = 0
ans = 0

for i in range(N):
  a.append(a[i] + A[i])

for i in range(M):
  b.append(b[i] + B[i])

j = M

for i in range(N+1):
  if a[i] > K:
    break
  while a[i] + b[j] > K:
    j -= 1
  ans = max(ans, i + j)


print(ans)
# Judge status: Accepted
n = int(input())
h = list(map(int,input().split()))
ans = 'Yes'
for i in range(n-1,0,-1):
    if h[i-1]-h[i]>1:
        ans = 'No'
        break
    elif h[i-1]-h[i]==1:
        h[i-1]-=1
print(ans)
# Judge status: Accepted
A = int(input())
B = int(input())
C = int(input())
X = int(input())

count=0

for i in range(A+1):
  for j in range(B+1):
    for k in range(C+1):
      if 500*i + 100*j + 50*k == X:
        count +=1

print(count)
# Judge status: Wrong Answer
from collections import defaultdict
def main():
    dd = defaultdict(int)
    dd["a"]=0;
    dd["b"]=0;
    dd["c"]=0;
    s = input()
    for i in range(len(s)):
        dd[s[i]]+=1 
    
    res = list(dd.values())
    if max(res)-min(res)>1:
        print("No")
    else:
        print("Yes")

if __name__ == "__main__":
    main()
# Judge status: Accepted
#!/usr/bin/env python3
import math

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

nans = (n * (n - 1)) // 2
mans = (m * (m - 1)) // 2

print(nans + mans)
# Judge status: Accepted
[H,A] = list(map(int,input().split()))

output = H//A+1
if H%A==0:
    output += -1
print(output)
# Judge status: Accepted
def solve():
    min_number, max_number = list(map(int, input().split()))

    current_number = min_number
    answer = 1

    while True:
        next_number = current_number * 2
        if next_number <= max_number:
            current_number = next_number
            answer += 1
        else:
            break

    print(answer)


solve()
# Judge status: Wrong Answer
import random

def name():
    S = input("S:")
    if len(S) > 20:
        return name()
    if len(S) < 3:
        return name()
    if S.isupper() == True:
        return name()
    if S.isalpha() == False:
        return name()
    else:
        l = list(S)
        x = random.randint(0, len(S) - 3)
        y = l[x]
        z = l.index(y)
        print(y + l[z+1] + l[z+2])
# Judge status: Accepted
import itertools

def solve():
  n = int(input())
  s = []
  for i in range(n):
    s.append(input())
  print(len(set(s)))
  return 0
 
if __name__ == "__main__":
  solve()
# Judge status: Accepted
import sys
import heapq, math
from itertools import zip_longest, permutations, combinations, combinations_with_replacement
from itertools import accumulate, dropwhile, takewhile, groupby
from functools import lru_cache
from copy import deepcopy

N = int(input())
A = list(map(lambda x: int(x) - 1, input().split()))

cnt = 0
for i in range(N - 1):
    if A[i] == i:
        cnt += 1
        A[i], A[i + 1] = A[i + 1], A[i]

if A[N - 1] == N - 1:
    cnt += 1

print(cnt)
# Judge status: Accepted
x,a,b=map(int,input().split());print('AB'[abs(x-a)-abs(x-b)>=0])
# Judge status: Wrong Answer
import sys
sys.setrecursionlimit(10 ** 5 + 10)
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())

    ans=0
    i=0
    while ans<n:
        i+=1
        ans+=i

    tot=0
    while True:
        if tot<n:
            print(i)
            tot+=i
            i=n-i
        else:
            break



resolve()
# Judge status: Accepted
import sys
a,b,c = map(int,input().split())
k=int(input())

i=0

while a >= b:
    b *= 2
    if i == k:
        print('No')
        sys.exit()
    else:
        i += 1

while b >= c:
    c *= 2
    if i == k:
        print('No')
        sys.exit()
    else:
        i += 1

print('Yes')
# Judge status: Wrong Answer
n=int(input())
h=list(map(int,input().split()))
ct=0
ans=0
flag=0
for i in range(n-1):
    ct+=1
    if h[i]<h[i+1]:
        flag=1
        if ans<ct:
            ans=ct
        ct=0
if ans<ct:
    ans=ct
if flag==1:
    print(0)
else:
    print(ans)
# Judge status: Wrong Answer
a, b, c = map(int, input().strip().split())

if a % b == 0 or b <= c:
    print('NO')
else:
    print('YES')
# Judge status: Accepted
N,a,b = map(int,input().split())

if (b-a)%2 ==0:
  ans = (b-a)//2
else:
  ans = min(a-1,N-b)+1 + (b-a-1)//2
print(ans)
# Judge status: Wrong Answer
n,m=map(int,input().split())
c=[]
cnt=0
for i in range(n):
    a=list(map(int,input().split()))
    for j in range(1,len(a)):
        c.append(a[j])
    
for j in range(1,m+1):
    if c.count(j)==n:
        cnt += 1
print(c)
print(cnt)
# Judge status: Wrong Answer
n=int(input())
ans = 1
for i in range(n):
    tmp = int(input())
    if (tmp % ans == 0):
        ans=tmp
    elif (ans % tmp != 0):
        ans *= tmp
print(ans)
# Judge status: Accepted
N, X, Y = map(int, input().split(' '))
X = X - 1
Y = Y - 1
cnt = [0] * N

for i in range(N):
    for j in range(N):
        if (j <= i): continue
        temp = j - i
        temp = min(temp, abs(i - X) + 1 + abs(j - Y))
        cnt[temp] = cnt[temp] + 1

for i in range(N):
    if i > 0:
        print(cnt[i])
# Judge status: Accepted
# LRRRRRRL, LRL は同じ(不幸な人は3人)
# L, R で分割してやると一回の操作でLRL -> LLL -> で不幸な人が2人へる LR の時は LLで1人減る
n, k = list(map(int, input().split(' ')))
s = input()

# LLRRRLL -> 1,1,1に変換して合体させていく
old = ''
converted = []
for c in s:
    if old != c:
        converted.append(1)
        old = c
temp = max(len(converted) - 2*k, 1)  # 必ず一人は犠牲になる
print(n - temp)
# Judge status: Wrong Answer
n = int(input())
c= input()

ans1=c.count("R")
ans2=c.count("W")

ans3=0
for i in range(n//2):
    if c[i]=="W":
        ans3+=1

print(min([ans1,ans2,ans3]))
# Judge status: Wrong Answer
N = int(input())
A = list(map(int, input().split()))

i = 1
j = 0
cnt = 0
while j <= N-1:
    if i == A[j]:
        i += 1
        j += 1
    else:
        j += 1
        cnt += 1
    
print(cnt if cnt < N-1 else "-1")
# Judge status: Wrong Answer
l=int(input())
if l%3==0:
    k=l/3
    print(k**3)
else:
    n=int(l/3)
    m=l-2*n
    print(n*n*m)
# Judge status: Accepted
x,y=map(int,input().split())
m=max(x,y)
mm=min(x,y)
print(m+max(m-1,mm))
# Judge status: Accepted
import sys


inint = lambda: int(sys.stdin.readline())
inintm = lambda: map(int, sys.stdin.readline().split())
inintl = lambda: list(inintm())
instrm = lambda: map(str, sys.stdin.readline().split())
instrl = lambda: list(instrm())

n = inint()
H = inintl()

h = H[0]

for i in range(1,n):
    if H[i]+1 < h:
        print("No")
        exit()
    if H[i] > h:
        h = H[i]

print("Yes")
# Judge status: Wrong Answer
N = int(input())
A = list(map(int,input().split()))
count = 0
countb = 0
min = min(A)
for i in A:
    if i % 2 == 0:
        count += 1

    if i % min == 0:
        countb += 1

if countb == N:
    print(min)
elif count == N:
    print(2)
else:
    print(1)
# Judge status: Accepted
import math
import statistics
N = int(input())
L = [i for i in map(int,input().split())]
Q = []
for i in range(len(L)):
  Q.append(L[i] - (i+1))
b = statistics.median(Q)
a = b - 1
c = b + 1
res = 0
res2 = 0
res3 = 0
for i in range(N):
  res += abs(L[i] - (i+1) - b)
  res2 += abs(L[i] - (i+1) - a)
  res3 += abs(L[i] - (i+1) - c)
print(int(min(res,res2,res3)))
# Judge status: Accepted
a, b, c, d = map(int, input().split())
if abs(c - a) <= d or (abs(b - a) <= d and abs(c - b) <= d):
    print('Yes')
else:
    print('No')
# Judge status: Accepted
a = int(input())
b = int(input())
h = int(input())
print( (a + b) * h // 2)
# Judge status: Wrong Answer
a, b = map(int, input().split())
x = [i  *(i + 1) // 2 for i in range(1, 1000)]
for i in x:
    if a <  i:
        print(i - a)
        break
# Judge status: Accepted
N, A, B = map(int, input().split())

if A > B:
    print(0)
elif N == 1 and A != B:
    print(0)
elif N == 1 and A == B:
    print(1)
else:
    print(A+B*(N-1)-(N-1)*A-B+1)
# Judge status: Accepted
n, m = map(int, input().split())
start = 1
end = n
for i in range(m):
    l, r = map(int, input().split())
    if start < l:
        start = l
    if r < end:
        end = r
print(max(end - start + 1, 0))
# Judge status: Accepted
a, b, c, d = map(int, input().split())
ans = 0 if (b <= c) or (d <= a) else min(b, d) - max(a, c)
print(ans)
# Judge status: Accepted
n=int(input())
if n==0:
	p=0
	print("%.9f"%p)
elif n&1:
	p=(n//2)+1
	print("%.9f"%(p/n))
else:
	p=n//2
	print("%.9f"%(p/n))
# Judge status: Wrong Answer
x,a,b = map(int,input().split())
print(min(abs(a-x),abs(b-x)))
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))
prev = a[0]
up = False
staks = 0
money = 1000
for i in a[1:]:
    if i > prev and not up:
        staks = money//prev
        money = money % prev
        up = not up
    if i < prev and up:
        money += prev*staks
        stacks = 0
        up = not up
    prev = i
if staks:
    money += prev*staks

print(money)
# Judge status: Accepted
n = int(input())
s = list(input())
ans = []
for i in range(len(s)):
  if (ord(s[i])+n)<=ord('Z'):
    ans.append(chr(ord(s[i])+n))
  else:
    ans.append(chr(ord(s[i])+n-26))
print(''.join(ans))