peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Wrong Answer
S = input()
T = input()

Slis = list(S)
Tlis = list(T)
Tlis.remove(Tlis[ - 1])
if len(S) == 0:
    print('No')
elif Slis  == Tlis:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
import math

n,h = map(int, input().split())
al = []
bl = []
for _ in range(n):
    a,b = map(int, input().split())
    al.append((a,'swing'))
    bl.append((b,'throw'))

abl = al + bl
abl.sort(reverse=True)

remain_h = h
ans = 0
for v in abl:
    damage, command = v
    if command == 'swing':
        ans += math.ceil(remain_h/damage)
        break
    else:
        ans += 1
        remain_h -= damage
        if remain_h <= 0:
            break

print(ans)
# Judge status: Accepted
from collections import Counter

N = int(input())

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

a = Counter(a)

ans = 0
for i in a:
    if i <= a[i]:
        ans+=a[i]-i
    else:
        ans+=a[i]

print(ans)
# Judge status: Accepted
a,b,c = map(int,input().split())
print('Yes' if (a+b)>=c else 'No')
# Judge status: Accepted
from math import ceil
n,k = map(int,input().split())	
a = list(map(int,input().split()))
print(ceil((n - 1) / (k - 1)))
# Judge status: Accepted
n,m = map(int,input().split())
ka = [list(map(int,input().split())) for i in range(n)]

cnt = [0]*(m+1)

for i in range(n):
  for j in range(1,ka[i][0]+1):
    cnt[ka[i][j]] += 1

print(cnt.count(n))
# Judge status: Accepted
n,x,y=map(int,input().split())
x-=1;y-=1
fl=[0 for i in range(n-1)]
for i in range(n):
    for j in range(i+1,n):
        fl[min(abs(j-i),abs(j-x)+1+abs(y-i),abs(i-x)+1+abs(y-j))]+=1
print(*fl[1:],sep="\n")
print(0)
# Judge status: Accepted
# -*- coding: utf-8 -*-

#110_c

S = input()
T = input()

combination = []
for i, j in zip(S,T):
    combination.append([i,j])

set_S = []
set_T = []

for i,j in list(map(list, set(map(tuple, combination)))):
    set_S.append(i)
    set_T.append(j)

if len(set_S) == len(set(set_S))and len(set_T) == len(set(set_T)):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
K, N = map(int, input().split())
A = list(map(int, input().split()))

dis = [(K+A[0]-A[-1])]

for i in range(len(A)):
    if i+1 == len(A):
        break
    dis.append(A[i+1] - A[i])


        
print(K - max(dis))
# Judge status: Accepted
import math

s = int(input())

x1 = 1000000000
y1 = 1
y2 = math.ceil(s / x1)
x2 = y2 * x1 - s

print(0, 0, x1, y1, x2, y2)
# Judge status: Wrong Answer
N, K = map(int, input().split())
ans = 0
for k in range(K, N+1):
  mi = k*(k-1)//2
  ma = k*(2*N-k+1)//2
  ans += ma - mi + 1
  ans %= 1000000007
print(ans)
# Judge status: Wrong Answer
import math
a, b = map(str, input().split())
a = int(a)
b = float(b)

print(a, b, a * b)
b = int(b * 1000)

print(a, b, a * b, a * b // 1000)
ans = int(a * b // 1000)
print(ans)
# Judge status: Accepted
n,k = map(int, input().split())
r = n % k
s = abs(r - k)
print(min(r,s))
# Judge status: Accepted
N, Q = map(int, input().split())
S = input()
t = [0] * (N+1)
for i in range(N):
    t[i+1] = t[i] + (1 if S[i:i+2] == 'AC' else 0)
for i in range(Q):
    l,r = map(int, input().split())
    print(t[r-1] - t[l-1])
# Judge status: Wrong Answer
A = [int(i) for i in input().split()]
ans = 100
for i in range(3):
    for j in range(i + 1, 3):
        ans = min(ans, A[i] + A[j])
print(ans)
# Judge status: Accepted
from collections import deque
n, m = map(int, input().split())
route = [[] for i in range(n)]

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

next_queue = deque()
sign = [-1] * n
sign[0] = 999

next_queue.append(0)

while next_queue:
    current_number = next_queue.popleft()
    for room in route[current_number]:
        if sign[room] == -1:
            sign[room] = current_number
            next_queue.append(room)
print("Yes")
for i in range(1, n):
    print(sign[i] + 1)
# Judge status: Accepted
N,M,K = map(int,input().split())
ans = 'No'
for x in range(M+1):
    if M-2*x == 0:
        if K%N == 0:
            ans = 'Yes'
            break
        else:
            continue
    else:
        if (K-N*x)%(M-2*x) == 0 and 0 <= (K-N*x)/(M-2*x) <= N:
            ans = 'Yes'
            break
        else:
            continue
print(ans)
# Judge status: Accepted
s= input()

number = s.rfind("Z") - s.find("A")
print(number+1)
# Judge status: Accepted
import math
print(math.ceil(sum(map(int,input().split())) / 2))
# Judge status: Accepted
X = int(input())
a = []
for i in range(4000):
  a.append(i**5)
for i in range(4000):
  if X + a[i] in a:
    A = int((X + a[i])**0.2)
    B = i
  elif X - a[i] in a:
    A = int((X - a[i])**0.2)
    B = -i
print(A,B)
# Judge status: Accepted
s = input()
ans = 'WA'
if s[0] == 'A' and s[2:-1].count('C') == 1\
   and s.replace('A', '').replace('C', '').islower():
  ans = 'AC'
print(ans)
# Judge status: Accepted
X=int(input())

for i in range(-1000,1000):
    for j in range(-1000,1000):
        if i**5==j**5+X:
            A=i
            B=j
            break
print(A,B)
# Judge status: Accepted
a, b, c = map(int, input().split())

if b // a < c:
    print(b//a)
else:
    print(c)
# Judge status: Accepted
n = int(input())
a = [int(i) for i in input().split()]
h = 0
c = 0
for ai in a:
    if ai < h:
        c += h - ai
    h = max(ai, h)
print(c)
# Judge status: Accepted
a=int(input())
if a >= 3200:
  print(input())
else:
  print('red')
# Judge status: Wrong Answer
#a,b,c,d=map(int,input().split())
n=int(input())
s=input()
ans=0
for i in s:
  if i=="I":
    ans+=1
  elif i=="D":
    ans-=1
  
if ans<0:
  print(0)
else:
  print(ans)
# Judge status: Wrong Answer
N,M = map(int,input().split())
# ue,sita,uee,sitaa = 0,0,0,0
# tmpN,tmpM = 0,0
# if N != 2:
#     for i in range(N+1):
#         ue *= N-i
#         sita *= N-2-i
#     tmpN = ue/sita
# if M != 2:
#     for i in range(M+1):
#         uee *= N-i
#         sitaa *= N-2-i
#     tmpM = uee/sitaa

# print(tmpN+tmpM)

ans = N*int(N/2) + M*int(M/2)
print(ans)
# Judge status: Wrong Answer
x,k,d=map(int,input().split())
if (x-(k*d))>0:
    print((x-(k*d)))
elif (x-(k*d))==0:
    print(0)
elif x==k and k==d:
    print(abs(x-0))
else:
    k1=0
    a=(x-(k1*d))
    while a>0:
        k1+=1
        a=(x-(k1*d))
    print(abs(a-0))
# Judge status: Accepted

N = int(input())
*A, = map(int, input().split())
for a in A:
    if a % 2 == 0:
        if a % 3 == 0 or a % 5 == 0:
            pass
        else:
            print("DENIED")
            exit()
print("APPROVED")
# Judge status: Accepted
n=int(input())
a=list(map(int,input().split()))
ans=[0]*(n+1)
for i in range(n,0,-1):
    temp=0
    for j in range(i,n+1,i): temp+=ans[j]
    if a[i-1]!=temp%2: ans[i]=1
print(sum(ans))           
for i in range(n+1):
    if ans[i]==1: print(i,end=" ")
# Judge status: Accepted
#!/usr/bin/env python
# coding: utf-8

# In[6]:


N = int(input())
S = input()


# In[9]:


w = S.count(".")
b = 0
ans = min(w,N-w)
for i in range(N):
    if S[i] == ".":
        w -= 1
    else:
        b += 1
    ans = min(ans, w+b)
print(ans)


# In[ ]:
# Judge status: Accepted
a, s, c = input().split()

print(a[0]+s[0]+c[0])
# Judge status: Accepted
n = int(input())
a = list(map(int, input().split()))
sa = sum(a)

b = [1]
f = True
for i in range(n+1):
    sa -= a[i]
    d = min(sa, (b[i] - a[i]) * 2)
    if d < 0:
        f = False
        break
    b.append(d)

print(sum(b) if f else -1)
# Judge status: Accepted
c = input().split()
print(len(list(set(c))))
# Judge status: Wrong Answer
s=input();print('NYOE S'[s[2]==s[3]and s[4]==s[5]::2])
# Judge status: Accepted
A, B, C = map(int, input().split())
print(max((C - (A - B)), 0))
# Judge status: Accepted
# A - Can't Wait for Holiday

# 文字列 S の入力
S = input()
# print(S)

# 何日後か求める条件文
if S == 'SUN':
    print(7)
elif S == 'MON':
    print(6)
elif S == 'TUE':
    print(5)
elif S == 'WED':
    print(4)
elif S == 'THU':
    print(3)
elif S == 'FRI':
    print(2)
elif S == 'SAT':
    print(1)
# Judge status: Wrong Answer
import math
x,y = map(int,input().split())
print(int(math.log2(y/x))+1)
# Judge status: Accepted
n,k,*_=map(int,open(0).read().split())
print(0--~-n//~-k)
# Judge status: Wrong Answer
import numpy as np
N, K, S = map(int, input().split())
X = [S for _ in range(K)]
Y = [S + 100 for _ in range(N - K)]
print(' '.join(map(str, X+Y)))
# Judge status: Wrong Answer
from statistics import mean 
import math
n=int(input())
arr=[int(x) for x in input().split()]
a=math.ceil(mean(arr))
s=0
for x in arr:
    s=s+((x-a)**2)
print(s)
# Judge status: Wrong Answer
A,B,C = map(int,input().split())
if C<=A and C>=B: 
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
import bisect
N = int(input())
seq = [-int(input()) for i in range(N)] 
LIS = [seq[0]]
for i in range(1,len(seq)):
    if seq[i] >= LIS[-1]:
        LIS.append(seq[i])
    else:
        LIS[bisect.bisect_left(LIS, seq[i])] = seq[i]
print(len(LIS))
# Judge status: Accepted
s = list(input())
s = s[:-1]
while s[:len(s)//2] != s[len(s)//2 :]:
    s = s[:-1]
    # print(s)
print(len(s))
# Judge status: Accepted
M = 10 ** 9 + 7
n = int(input())

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

nones = 8
zero = 1
nine = 1
other = 0
for x in range(1, n):
    other = other * 10 + zero + nine
    zero = zero * 9 + nones
    nine = nine * 9 + nones
    nones *= 8

    other %= M
    zero %= M
    nine %= M
    nones %= M

print(other)
# Judge status: Wrong Answer
n, m = map(int, input().split())
a = list(map(int, input().split()))
u = sum(a) / (4*m)
l = 0
for i in a:
    if i > u:
        l += 1
print("Yes") if l >= m else print("No")
# Judge status: Wrong Answer
# coding: utf-8
# Your code here!

N=list(input())
if len(set(N))==1:
    print(''.join(N))
else:
    if int(N[0])<int(N[1]) or int(N[1])<int(N[2]) or int(N[0])<int(N[2]):
        N=[int(N[0])+1]*len(N)
    else:
        N=[int(N[0])]*len(N)
    print(''.join(map(str,N)))
# Judge status: Accepted
Sp = input()
T = input()
S = []
for i in range(len(Sp)-len(T)+1):
	for j in range(len(T)):
		if Sp[i+j] not in ("?",T[j]):
			break
	else:
		tmp = Sp[:i] + T + Sp[i+len(T):]
		S.append(tmp.replace("?","a"))

print(min(S) if S else "UNRESTORABLE")
# Judge status: Accepted
n = int(input())
l = list(map(int,input().split()))

if sum(l) > 2*max(l):
 print("Yes")
else:
 print("No")
# Judge status: Accepted
import sys
from collections import deque

input = sys.stdin.readline
N, K = map(int, input().split())
A = list(map(int, input().split()))

visited = set()
q = deque()
q.append(1)

root = []
while q:
    pos = q.pop()
    if pos in visited:
        start = root.index(pos)
        s_len = len(root[:start])
        l_len = len(root[start:])
        break
    visited.add(pos)
    root.append(pos)

    q.append(A[pos-1])

if K <= s_len:
    print(root[K])
else:
    r = (K - s_len) % l_len
    print(root[start+r])
# Judge status: Accepted
n = int(input())
W = []
for _ in range(n):
    w = input()
    if w in W:
        print('No')
        exit()
    W.append(w)

for i in range(n-1):
    if W[i][-1] != W[i+1][0]:
        print('No')
        exit()
print('Yes')
# Judge status: Accepted
n=int(input())
ans=0
for i in range(1,n+1,2):
    ct=0
    for j in range(1,i+1):
        if i%j==0: ct+=1
    if ct==8: ans+=1
print(ans)
# Judge status: Accepted
a = list(input())
j = 0
for i in range(2):
    if len(set(a[i:i+3])) == 1:
        j = 1
    
if j == 1:
    print("Yes")
else:
    print("No")
# Judge status: Wrong Answer
N = int(input())
x = N//100
y = N%100
if x == 0:
  print(1)
  exit()
if y/x > 5:
  print(0)
else:
  print(1)
# Judge status: Accepted
K,A,B = list(map(int,input().split()))

if K+1 <= A:
    print(K+1)
else:
    if 2 <= B-A:
        K -= A-1
        ans = A + K//2 * (B-A)
        if K%2 == 1:
            ans += 1
    else:
        ans = K+1
    print(ans)
# Judge status: Accepted
N = int(input())
print("ABC" if N <1000 else "ABD")
# Judge status: Wrong Answer
D,T,S = map(int,input().split())
result = D / S
if T > result:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
def num2alpha(num):
    if num<=26:
        return chr(64+num)
    elif num%26==0:
        return num2alpha(num//26-1)+chr(90)
    else:
        return num2alpha(num//26)+chr(64+num%26)
n = int(input())
ans = num2alpha(n)
print(ans)
# Judge status: Accepted
mod = int(1e9 + 7)

def pw(b, ex):
    if ex == 0: return 1
    if ex == 1: return b
    if ex & 1: return b % mod * pw((b*b) % mod, ex >> 1) % mod
    return pw((b*b) % mod, ex >> 1) % mod

n = int(input())
x = list(map(int,input().split()))
st = 0
en = 0

for i in x:
    st = (st + i) % mod
    en = (en + (i * i) % mod) % mod
    
st *= st
ans = int((st - en + mod) % mod)
ans = int(ans * int(pw(2, mod - 2)) % mod) % mod
print (int(ans))
# Judge status: Wrong Answer
n = int(input())
mod = 7 + 10**8
ans = 1

for i in range(1,n+1):
  ans = (ans%mod) * (i%mod) % mod
print(ans)
# Judge status: Wrong Answer
import fractions

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

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

def solve():
    memo = 0
    for i in range(N - 1):
        if i == 0:
            memo = lcm(A[i], A[i + 1])
        memo = lcm(memo, A[i + 1])

    ans = 0
    for i in range(N):
        ans += memo // A[i]

    return ans % (10 ** 9 + 7)

print(solve())
# Judge status: Wrong Answer
n = input()
if n: print(0)
else: print(1)
# Judge status: Wrong Answer
x, y = map(int, input().split())

if y % x == 0:
    print(-1)
else:
    print(x)
# Judge status: Wrong Answer
A = int(input())
B = int(input())
C = int(input())
X = int(input())

ans =0
for i in range(A):
  for j in range(B):
    for k in range(C):
      tmp = 500*i + 100*j +50*k
      if X == tmp:
        ans +=1
print(ans)
# Judge status: Wrong Answer
from collections import deque
N, M = map(int, input().split())

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

d = deque(sorted(A)[::-1])
d_2 = deque([])
a = d.popleft()
d_2.append(a // 2)
M -= 1

while M > 0:
    if len(d) > 0 and d[0] > d_2[-1]:
        a = d.popleft()
        d_2.appendleft(a // 2)
    else:
        d_2[-1] //= 2
    M -= 1

print(sum(d) + sum(d_2))
# Judge status: Accepted
import sys
x = int(sys.stdin.readline())

a = x //500
b = (x%500)//5
print(1000*a + 5*b)
# Judge status: Accepted
from math import floor
inp = input()
a, b = inp.split()
b += '00000001'
a = int(a)
b = float(b)
b100 = int(b * 100)
ans100 = a * b100
ans = ans100 // 100
print(ans)
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
N = int(input())
ans = 0
while(True) :
    if N <= 9 :
        ans += N
        break
    else :
        ans += 9
    if N >= 100 :
        if N < 1000 :
            ans += N - 100 + 1
            break
        else :
            ans += 900
    else :
        break
    if N >= 10000 :
        ans += N - 10000 + 1
        break
    else :
        break
print(ans)
# Judge status: Wrong Answer
S = input()
target = "keyence"
length = len(target)+1

if target in S:
    print("YES")
    exit()
else:
    for i in range(1, length):
      first = target[:i]
      second = target[i:]
      if first in S and second in S and S.find(first) <= S.rfind(second):
        print("YES")
        exit()
print("NO")
# Judge status: Wrong Answer
from sys import stdin
from decimal import Decimal
N = int(stdin.readline().rstrip())
A = []
B = []
for i in range(N):
    a,b = [int(x) for x in stdin.readline().rstrip().split()]
    A.append(a)
    B.append(b)
    
A.sort()
B.sort()
if N % 2 == 0:
    ans = Decimal(sum(B))/Decimal(2) - Decimal(sum(A))/Decimal(2)
    ans /= Decimal(0.5)
    print(int(ans))
else:
    ans = B[N//2] - A[N//2] + 1
    print(ans)
# Judge status: Wrong Answer
N=int(input())
A=[tuple(map(int,input().split())) for i in range(N)]
A.sort(key=lambda x: x[1])
a=0
b=0 
c=0   
for i in range(len(A)):
   a+=A[i][0]
   b+=A[i][1]
   if a>b:
      c+=1
      print('No')
      break
if c==0:
  print('Yes')
# Judge status: Accepted
def main():
    n, x, y = map(int, input().split()) 

    ans = [0] * n
    for i in range(1,n):
        for j in range(i+1, n+1):
            r1 = j-i
            r2 = abs(x-i) + 1 + abs(j-y)
            r3 = abs(y-i) + 1 + abs(j-x)
            ans[min(r1,r2,r3)] += 1

    for i in range(1,n):
        print(ans[i])

if __name__ == "__main__":
    main()
# Judge status: Accepted
def main():
    '''
    N = aq + r (0 <= r <= a-1)よりΣrを最大にするのはr = a-1のとき
    '''
    N = int(input())
    print(N * (N - 1) // 2)


if __name__ == '__main__':
    main()
# Judge status: Accepted
n,x = map(int,input().split(" "))
l = list(map(int,input().split(" ")))
y = 0
for i in l:
    y += i
if y <= x:
    print(n+1)
else:
    count = 1
    d = 0
    j = 0
    while d < x:
        d += l[j]
        j += 1
        if d <= x:
            count += 1
    print(count)
# Judge status: Accepted
n = int(input())
w = list(map(int, input().split()))
m = []
for i in range(n - 1):
    T1 = sum(w[:i - 2])
    T2 = sum(w) - T1
    m.append(abs(T1 - T2))
print(min(m))
# Judge status: Accepted
import sys

def Ss():
  return sys.stdin.readline().rstrip().split(' ')

def Is():
  ss = Ss()
  return map(int, ss) if len(ss) > 1 else int(ss[0])

a, b, c = Is()
k = Is()

while b <= a:
    b = b * 2
    k = k - 1
    
while c <= b:
    c = c * 2
    k = k - 1

print('Yes' if k >= 0 else 'No')
# Judge status: Accepted
import itertools

N, K = map(int, input().split())
A = list(map(int, input().split()))
end = [N] * N

for _ in range(K):
    lst = [0] * N
    for i, a in enumerate(A):
        lst[max(0, i - a)] += 1
        if i + a + 1 < N:
            lst[i + a + 1] -= 1
    A = list(itertools.accumulate(lst))
    if A == end:
        break
print(*A)
# Judge status: Accepted
def main():
    k = int(input())
    num = 1
    n = 7

    if (k % 2 == 0):
        print(-1)
        return
    
    for i in range(1000000):
        if (n % k == 0):
            print(num)
            return
        else:
            n = (n*10 + 7) %k
            num += 1
    print(-1)

if __name__ == '__main__':
    main()
# Judge status: Accepted
s = input()
t = input()
if s == t[:-1]:
  print('Yes')
else:
  print('No')
# Judge status: Wrong Answer
a,b = input().split()
x = int(a+b)
flag = False
for i in range (101):
    if x == i*i:
        flag = True
        break
if flag:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
N = int(input())
As = list(map(int, input().split()))
r = sum(As)
nAs = {}
for A in As:
  if A not in nAs:
    nAs[A] = 0
  nAs[A] += 1
Q = int(input())
for i in range(Q):
  B, C = map(int, input().split())
  if B not in nAs:
    print(r)
    continue
  n = nAs[B]
  if C not in nAs:
    nAs[C] = 0
  r += (C-B)*n
  nAs[B] = 0
  nAs[C] += n
  print(r)
# Judge status: Wrong Answer
def main():
    d={25:"Chiristmas", 24:"Christmas Eve", 23:"Christmas Eve Eve", 22:"Christmas Eve Eve Eve"}
    print(d[int(input())])
    
if __name__ == "__main__":
    main()
# Judge status: Accepted
N = int(input())
A = list(map(int,input().split()))

s = [0]*(N+1)
for i in range(N):
    s[i+1] = s[i] + A[i]
    
cnt = 0
for j in range(N):
    cnt =  (cnt + (A[j]*(s[N] - s[j+1])))%(10**9+7)
print(cnt)
# Judge status: Wrong Answer
n = int(input())
lia = list(map(int,input().split()))
lib = list(map(int,input().split()))
mon = sum(lia)
for i in range(n):
    k = lia[i] - lib[i]
    if k <= 0:
        lia[i] = 0
        lia[i+1] += k
        if lia[i+1] < 0:
            lia[i+1] = 0
print(mon-sum(lia))
# Judge status: Accepted
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
k = int(input())

if (e-a) > k:
    print(":(")
else:
    print("Yay!")
# Judge status: Accepted
from collections import Counter
N = int(input())
S = Counter(input())
ans = 1
for v in S.values():
    ans *= (v+1)
    ans %= (10**9+7)
print(ans-1)
# Judge status: Wrong Answer
def resolve():
    N=int(input())
    nine=[1]
    i=1
    while 9**i<=N:
        nine.append(9**i)
        i+=1
    i=1
    while 6**i<=N:
        nine.append(6**i)
        i+=1

    nine.sort(reverse=True)

    cnt=0
    i=0
    while N>0:
        cnt+=N//nine[i]
        N-= nine[i]*(N//nine[i])
        i+=1

    print(cnt)
resolve()
# Judge status: Accepted
from collections import Counter,defaultdict,deque
from heapq import heappop,heappush
from bisect import bisect_left,bisect_right 
import sys,math,itertools,fractions,pprint
sys.setrecursionlimit(10**8)
mod = 10**9+7
INF = float('inf')
def inp(): return int(sys.stdin.readline())
def inpl(): return list(map(int, sys.stdin.readline().split()))

n = inp()
s = input()
t = input()
for i in range(n):
    for j in range(n-i):
        if s[i+j] != t[j]:
            break
    else:
        print(n+i)
        break
else:
    print(n*2)
# Judge status: Wrong Answer
n,m = map(int, input().split())

a = [ int(x) for x in input().split()]
print(n-sum(a))
# Judge status: Wrong Answer
n=int(input())
a=input()

x=a.count(".")
y=a.count("#")

print(min(x,y))
# Judge status: Wrong Answer
N = int(input())
a = list(map(int,input().split()))

a.sort()
s = 0

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

print(s)
# Judge status: Wrong Answer
k = int(input())

if k % 2 == 0:
    print(-1)
else:
    count= 1
    if k==7:
        print(1)
    else:
        now = 7%k
        while(1):
            count += 1
            now = (now*10) % k + 7 % k
            if now % k == 0:
                print(count)
                exit()
# Judge status: Accepted
H = int(input())


def f(H):
    if H == 1:
        return 1
    else:
        return f(H//2) * 2 + 1

print(f(H))
# Judge status: Accepted
n, d = map(int, input().split())
ans = 0
for i in range(n):
    x, y = map(int, input().split())
    if x**2 + y**2 <= d**2:
        ans += 1
print(ans)
# Judge status: Accepted
n = int(input())
arr = [int(a) for a in input().split()]
s = sum(arr)
m = s // 2

tmp = 0
for a in arr:
    if tmp + a >= m:
        ans = min(s-tmp*2, (tmp+a)*2-s)
        break
    tmp += a

print(ans)
# Judge status: Wrong Answer
a, b = input().split()
 
if 500*a >= b:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
import math
l=[int(input()) for i in range(5)]
li=[math.ceil(n/10)*10 for n in l]
s=sum(li)
ans=10000
for i in range(4):
    ss=s-li[i]+l[i]
    ans=min(ss,ans)
print(ans)
# Judge status: Accepted
n = int(input())

l0 = 2
l1 = 1
if n == 1:
    print(l1)
else:
    for i in range(1, n):
        l2 = l0 + l1
        l0 = l1
        l1 = l2
    print(l2)
# Judge status: Accepted
n=int(input())
a=sorted(list(map(int,input().split())))[::-1]
ans=0
for i in range(1,n):
  ans+=a[i//2]
print(ans)
# Judge status: Wrong Answer
MOD = 10**9+7
X, Y = map(int, input().split())

if (X+Y)%3 != 0:
    print (0)
    exit()

W = X - ((X+Y)//3)
H = Y - ((X+Y)//3)

mx = 2*10**6
fact = [1] * (mx+1) # 階乗を格納するリスト
def inv(n): # MODを法とした逆元
    return pow(n, MOD-2, MOD)
for i in range(mx):
    fact[i+1] = fact[i] * (i+1) % MOD # 階乗を計算
ans = (fact[W+H] * inv(fact[W]) * inv(fact[H])) % MOD # comb(W+H,W) = (W+H)!/(W!H!)
print (ans)
# Judge status: Accepted
A,B,C,D = map(int,input().split())
print(max(min(B,D)-max(A,C),0))
# Judge status: Wrong Answer
N, _ = list(map(int, input().split()))
d = set(input().replace(" ", ""))

for i in range(1,1000001):
  n = str(N*i)
  ns = set(list(n))
  flg = False
  for t in ns:
    if t in d:
      flg = True
      break
  if flg == False:
    print(n)
    exit()
print(0)
# Judge status: Wrong Answer
#A
N = list(input())
if any(N) ==7:
    print('Yes')
else:
    print('No')
# Judge status: Wrong Answer
N, A, B = input().split(' ')
N = int(N)
A = int(A)
B = int(B)
Count = -(-(B-A)//2)
print(Count)
# Judge status: Accepted
# -*- coding: utf-8 -*-
"""
Created on Sat Aug 15 17:00:46 2020

@author: saito
"""

# %% import phase

# %% define phase

# %% input phase
N = int(input())
S = [0]*N
for i in range(N):
    S[i] = input()

# %% process phase
C = [0]*4
rslt = ['AC', 'WA', 'TLE', 'RE']
for i in range(4):
    C[i] = S.count(rslt[i])

# %%output phase
for i in range(4):
    print(rslt[i]+' '+'x'+' '+str(C[i]))
# Judge status: Accepted
y = input()
print(y.replace("2017", "2018"))
# Judge status: Accepted
n, k = map(int, input().split())
s = input()

if s[k-1]=="A":
    print(s[:k-1]+"a"+s[k:])
elif s[k-1]=="B":
    print(s[:k-1]+"b"+s[k:])
else:
    print(s[:k-1]+"c"+s[k:])
# Judge status: Accepted
N=int(input())
A=[int(input()) for i in range(N)]
max_val1=sorted(A)[-1]
max_val2=sorted(A)[-2]
for x in A:
  print(max_val2 if x==max_val1 else max_val1)