peterverebics/CodeNet_Python_428 huggingface dataset:
# Judge status: Accepted

#168 B
K = int(input())
S = input()

if len(S) <= K:
	print(S)
else:
	print(S[:K] + '...')


#168 A
#n_last = int(list(input())[-1])

#if n_last in [3]:
#	print('bon')
#elif n_last in [0,1,6,8] :
#	print('pon')
#else:
#	print('hon')
# Judge status: Wrong Answer
import sys

a = 3
b = sys.argv

print(a)
print(b)
# Judge status: Accepted
import math

s = int(input())
mod = 10**9 + 7

maxN = s//3
result = 0
for i in range(1, maxN+1): 
  tmp = s - 3*i
  if tmp == 0: 
    result += 1
  else: 
  	result += math.factorial(tmp+i-1)//(math.factorial(i-1)*math.factorial(tmp))

print(result%mod)
# Judge status: Accepted


def resolve():
    s=input()
    K=int(input())
    for i in s:
        if i!='1':
            print(i)
            break
        else:
            if K==1:
                print(1)
                break
            K-=1
        



if __name__ == "__main__":
    resolve()
# Judge status: Wrong Answer
n = int(input())
a = list(map(int, input().split()))

a_even = list(filter(lambda x: x % 2 == 0, a))
a_odd = list(filter(lambda x: x % 2 != 0, a))

ans = a_even[::-1] + a_odd
if n % 2 != 0:
  ans = ans[::-1]

print(' '.join(map(str, ans)))
# Judge status: Accepted
n = int(input())
R = []
for _ in range(n):
    x, l = map(int, input().split())
    R.append((x+l, x-l))
R.sort()

ans = 0
last = -1e10
for r, l in R:
    if last <= l:
        ans += 1
        last = r
print(ans)
# Judge status: Accepted
from fractions import *
g=gcd(*map(int,input().split()))
c=i=1
while i*i<=g and g>1:
  i+=1; c+=g%i<1
  while g%i<1: g//=i
print(c+(g>1))
# Judge status: Accepted
N,D = map(int,input().split())
DD = D*D
ans = 0
for i in range(N):
    x,y = map(int,input().split())
    if x*x + y*y <= DD:
        ans +=1
print(ans)
# Judge status: Wrong Answer
a = [0] * 3
for i in range(3):
    a[i] = list(map(int, input().split()))
n = int(input())
b = set()
for _ in range(n):
    b.add(int(input()))

if (
    set(a[0]) <= b
    or set(a[1]) <= b
    or set(a[2]) <= b
    or set(a[:][0]) <= b
    or set(a[:][1]) <= b
    or set(a[:][2]) <= b
    or {a[0][0], a[1][1], a[2][2]} <= b
    or {a[0][2], a[1][1], a[2][0]} <= b
):
    print("Yes")
else:
    print("No")
# Judge status: Accepted
a, b, x = map(int, input().split())
print(b // x + 1 if a == 0 else b // x - (a - 1) // x)
# Judge status: Accepted
N, W = map(int, input().split())
A = list()
for n in range(N):
	A.append(list(map(int, input().split())))
dp = [[0 for w in range(W+1)] for n in range(N+1)]
for i in range(W+1):
	dp[0][i] = 0
for p in range(1, N+1):
	for q in range(W+1):
		dp[p][q] = dp[p-1][q]
		if (A[p-1][0] <= q):
			dp[p][q] = max(dp[p][q], dp[p-1][q - A[p-1][0]] + A[p-1][1])
# print(dp)
print(dp[N][W])
# Judge status: Accepted
N,K=map(int,input().split())
h=list(map(int,input().split()))
cost=[0,abs(h[1]-h[0])]

for i in range(2,N):
    cand=10**10
    for j in range(K):
        if j==i:
            break
        cand=min(cand,cost[i-j-1]+abs(h[i]-h[i-j-1]))
    cost.append(cand)

print(cost[-1])
# Judge status: Accepted
a,b = map(int,input().split())
if a%3 == 0 or b%3 ==0 or (a+b)%3 == 0:
  print('Possible')
else:
  print('Impossible')
# Judge status: Accepted
N=(input())
x=N.count("7")
if x>0:
    print("Yes")
else:
    print("No")
# Judge status: Accepted
from fractions import gcd
N=int(input())
A=list(map(int,input().split()))

L=[0]*N
R=[0]*N
L[0]=A[0]
R[0]=A[N-1]

for n in range(1,N):
  L[n]=gcd(A[n],L[n-1])
  R[n]=gcd(A[N-n-1],R[n-1])
  
  ans=max(L[N-2],R[N-2])

for i in range(1,N-1):
  ans=max(ans,gcd(L[i-1],R[N-i-2]))

print(ans)
# Judge status: Wrong Answer
A,B,C,D = map(int,input().split())
#print(A,B,C,D)

while A > 0:
    C -= B
    A -= D
    if C <= 0:
        print("Yes")
        
    elif A <= 0:
        print("No")
    else:
        pass
# Judge status: Accepted
n = int(input())
s = [0, 0, 0]
ans = 'Yes'
for i in range(n):
  l = list(map(int, input().split()))
  diff_t = l[0] - s[0]
  diff_x = abs(s[1] - l[1])
  diff_y = abs(s[2] - l[2])
  s = [l[0], l[1], l[2]]
  if diff_x + diff_y > diff_t or (diff_t - diff_x - diff_y) % 2 != 0:
    ans = 'No'
print(ans)
# Judge status: Accepted
n,m = map(int,input().split())

if (n == 1) and (m == 1):
  ans = 1
elif n == 1 and m != 1:
  ans = m-2
elif m == 1 and n != 1:
  ans = n-2
else:
  ans = (m-2)*(n-2)
  
print(ans)
# Judge status: Accepted
N = input()
L = list(map(int,input().split()))
n=0
m=0
p=0
for a in range(int(N)):
  if L[a]%2 != 0:
    n+=1
  elif L[a]%2 == 0 and L[a]%4 != 0:
    m+=1
  else:
    p+=1
if int(N)%2==1 and (n>p+1 or p==0 and n==1):
  print("No")
elif int(N)%2==0 and n>p:
  print("No")
else:
  print("Yes")
# Judge status: Wrong Answer
n = int(input())
print(1/2 * n * (n+1))
# Judge status: Accepted
n = int(input())
ans = 0
for i in range(1,n):
    ans += ((n-1)//i)
print(ans)
# Judge status: Accepted
import bisect
N = int(input())
L = sorted(list(map(int, input().split())))

ans = 0
for i in range(N-1,1,-1):
  for j in range(i-1,0,-1):
    t = bisect.bisect(L, L[i]-L[j])
    if j-t>0: ans+=j-t
print (ans)
# Judge status: Accepted
day = ['SUN', 'MON', 'TUE', 'WED', 'THU', 'FRI', 'SAT']

s = input()
print(7 - day.index(s))
# Judge status: Accepted
from math import gcd
a, b = map(int, input().split())
x = gcd(a,b)
cnt = 1
for i in range(2, int(x ** 0.5) + 1):
        if x == 1:
            break
        if x % i == 0:
            cnt += 1
            while x % i == 0:
                x //= i
else:
    if x != 1:
        cnt += 1
print(cnt)
# Judge status: Accepted
A, B = map(int, input().split())

for i in range(1, 1001):
    if A==int(i*8/100) and B==int(i*10/100):
        print(i)
        exit()

print(-1)
# Judge status: Wrong Answer
n=int(input())
flag = False
for i in range(1, 10):
    for j in range(1,10):
        if i*j==n:
            print("Yes")
        else:
            flag = True

if flag:
    print("No")
# Judge status: Accepted
#!/usr/bin/env python3
n = int(input())


def e(k):
    m = n // k
    print
    return (m + 1) * m // 2 * k


print(e(1) - e(3) - e(5) + e(15))
# Judge status: Accepted
a, b = map(int, input().split())

if a <= b:
    print(a)
else:
    print(a-1)
# Judge status: Wrong Answer
N = int(input())
A = int(input())

a = 0
for i in range(20):
  if N >= 500*(i+1):
    a =  500*(i+1)
  else:
    continue
    
b = N - a

if b <= A:
  print("Yes")
else:
  print("No")
print(b)
# Judge status: Accepted
_=input();*C,=input();print(len([''for _ in range(C.count('W'))if C and C.pop()=='R']))
# Judge status: Accepted
T = input()
ans = T.replace('?', 'D')
print(ans)
# Judge status: Accepted
from string import ascii_lowercase
n = int(input())
S = input()
mod = 10**9 + 7
s = 1
for c in ascii_lowercase:
  s *= S.count(c)+1
  s %= mod
print(s-1)
# Judge status: Accepted
L, R, d = map(int, input().split())
print(R//d - (L-1)//d)
# Judge status: Accepted
A=[]
for i in range(3):
  a,b,c=map(int,input().split())
  A+=[a,b,c]
  
n=int(input())
T=[0]*9
for i in range(n):
  p=int(input())
  if p in A:
    T[A.index(p)]=1
    
if [1,1,1] in [T[0:3],T[3:6],T[6:9],T[0:7:3],T[1:9:3],T[2:9:3],T[0:10:4],T[2:7:2]]:
  print("Yes")
else:
  print("No")
# Judge status: Accepted
def resolve():
    N = int(input())
    W = list(map(int, input().split()))

    ans = sum(W)
    for i in range(N):
        tmp = abs(sum(W[:i + 1]) - sum(W[i + 1:]))
        # print(W[:i + 1], W[i + 1:])
        ans = min(ans, tmp)

    print(ans)


resolve()
# Judge status: Wrong Answer
n = int(input())

if n > int(str(n)[0]*3):
  print(str(int(str(n)[0])+1)*3)
else:
  print(n)
# Judge status: Accepted
n = int(input())

import bisect

dp = [-1]*(n+1)

for i in range(n):
  v = int(input())
  l = bisect.bisect_left(dp, v)
  if l==n+1:
    l -= 1
  if dp[l]<v:
    dp[l] = v
  else:
    dp[l-1] = v

cnt = 0
for i in range(n, 0, -1):
  if dp[i]>=0:
    cnt += 1
  else:
    break
    
print(cnt)
# Judge status: Accepted
def solve():
    A, B, C = map(int, input().split())
    if A == B == C and A % 2 == 0:
        return -1

    cnt = 0
    while True:
        if A % 2 or B % 2 or C % 2:
            return cnt
        A, B, C = B // 2 + C // 2, A // 2 + C // 2, A // 2 + B // 2
        cnt += 1


print(solve())
# Judge status: Wrong Answer
from collections import deque

deq=deque()
deq.append(input())
q=int(input())
x=True
for i in range(q):
	a=input()
	if a[0]=="1":
		x = not x
	elif a[2]=="1":
		if x%2!=0:
			deq.appendleft(a[4])
		else:
			deq.append(a[4])
	else:
		if x%2!=0:
			deq.append(a[4])
		else:
			deq.appendleft(a[4])
if x==True:
	c="".join(deq)
else:
	deq.reverse()
	c="".join(deq)
print(c)
# Judge status: Accepted
N, T = list(map(int,input().split()))
L1 = [list(map(int,input().split())) for _ in range(N)]
L2 = []
for i in L1:
    if i[1] <= T:
        L2.append(i)
if len(L2) == 0:
    print('TLE')
else:
    cost = []
    for i in L2:
        cost.append(i[0])
    print(min(cost))
# Judge status: Accepted
n = int(input())
cnt = 0
mcnt = 0
ans = 1
temp = 0

for i in range(2, n + 1):
    temp = i
    while i%2 == 0:
        i //= 2
        cnt += 1
    if cnt > mcnt:
        mcnt = cnt
        ans = temp
    cnt = 0

print(ans)
# Judge status: Accepted
a,b = map(int, input().split())
if a == b:
  print("Draw")
else:
  if a == 1:
    print("Alice")
  else:
    if b == 1:
      print("Bob")
    else:
      if a > b:
        print("Alice")
      else:
        print("Bob")
# Judge status: Accepted
a = input()
b = input()
if a[0]==b[2] and a[1]==b[1] and a[2]==b[0]:
  print("YES")
else:
  print("NO")
# Judge status: Wrong Answer
import math
N = int(input())
A = list(map(int,input().split()))
dp_left=[0]*(N+1)
dp_right=[0]*(N+1)
for i in range(N):#左から累積GCD
  dp_left[i+1]=math.gcd(dp_left[i],A[i])
  dp_right[N-i-1]=math.gcd(dp_right[N-i],A[N-1-i])#右から累積GCD

print(dp_left)
print(dp_right)


ans = 0
for i in range(N):
  ans = max(ans,math.gcd(dp_left[i],dp_right[i+1]))
print(ans)
# Judge status: Accepted
N,A,B = list(map(int, input().split()))


print(max((N-2)*B-(N-2)*A+1,0))
# Judge status: Accepted
x = int(input())

if x >= 30:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
# C - Divide the Problems
N = int(input())
d = list(map(int,input().split()))
d.sort()
print(d[N//2]-d[N//2-1])
# Judge status: Wrong Answer
import sys
readline = sys.stdin.readline

def solve():
    N = int(readline())
    L = list(map(int, readline().split()))

    if N <= 2:
        print(0)

    L.sort()
    ans = 0
    for i in range(N):
        for j in range(i + 1, N):
            for k in range(j + 1, N):
                if len(set((L[i], L[j], L[k]))) == 3 and L[k] < L[i] + L[j]:
                    ans += 1
    
    print(ans)
                

solve()
# Judge status: Accepted
x, a, b = map(int, input().split())
if abs(x-a) < abs(x-b):
    print('A')

else:
    print('B')
# Judge status: Accepted
def resolve():
    n = int(input())
    x = input()
    dict = {}
    for i in range(len(x)):
        if x[i] in dict:
            dict[x[i]] += 1
        else:
            dict[x[i]] = 1
    dictvalue = list(dict.values())
    ans = 1
    for i in dictvalue:
        ans *= (i+1)
        ans %= 10**9+7
    print(ans-1)
resolve()
# Judge status: Accepted
a, b = map(int, input().split())

if a<=b:
  print(a)
elif a>b:
  print(a-1)
# Judge status: Accepted
X,Y,Z = map(int, input().split())
print(Z,X,Y)
# Judge status: Wrong Answer
l = list(map(int,input().split()))

if l[1] <= l[2]:
    print(0)
else:
    ls = sorted(l)
    print(ls[2]-ls[1])
# Judge status: Accepted
dishes = [int(input()) for _ in range(5)]

dishes = sorted(dishes, key=lambda x: 10 - int(str(x)[-1]))
a = list()
b = list()
for d in dishes:
    if d % 10 == 0:
        a.append(d)
    else:
        b.append(d)
if len(b) > 0:
    b = [d + 10 - d % 10 for d in b[:-1]] + [b[-1]]
dishes = a + b
print(sum(dishes))
# Judge status: Accepted

n,m = map(int,input().split())
l=list(map(int,input().split()))
r=[True]*(n+1)
r[0]=False
d={}
for i in range(m):
    a,b=map(int,input().split())
    if l[a-1]>l[b-1]:
        r[b]=False
    if l[a-1]<l[b-1]:
        r[a]=False
    if l[a-1]==l[b-1]:
        r[a]=False
        r[b]=False
cnt=0
for i in r:
    if i:
        cnt+=1

print(cnt)
# Judge status: Wrong Answer
a = input()
b = input()
ans = 0
for i in range(len(a)):
  if a[i] == b[i]:
    ans += 1
print(ans)
# Judge status: Accepted
import itertools
import math
import fractions
import functools
import copy
n = int(input())
t, a = map(int, input().split())
h  = list(map(int, input().split()))
minimum = 10**10
index = 0
for i in range(n):
    minimum = min(minimum,abs(a-(t-h[i]*0.006)))
    if minimum == abs(a-(t-h[i]*0.006)):
        index = i

print(index+1)
# Judge status: Accepted
S = input()

n1 = len(S)
n2 = len(set(S))

if n1 == n2: print('yes')
else: print('no')
# Judge status: Accepted
from math import gcd
n = int(input())
ans = 0

for i in range(1,n+1):
  for j in range(1,n+1):
    x = gcd(i,j)
    for k in range(1,n+1):
        ans += gcd(x,k)
print(ans)
# Judge status: Accepted
n=int(input())
a=[]
b=[]

ans=0

for i in range(n):
  x,y=map(int,input().split())
  
  a.append(x)
  b.append(y)
  

for i in range(n):
  a[i]%=b[i]

a.reverse()
b.reverse()
  

for i in range(n):
  z=b[i]-(a[i]+ans)%b[i]
  if z==b[i]:
    z=0
  ans+=z


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

for i in range(3):
    if s[i] == s[i+1]:
        print('Bad')
        exit()
print('Good')
# Judge status: Accepted
s = input()

if s == 'keyence':
    print('YES')
    exit()

for i in range(0,len(s)-1):
    for j in range(i+1,len(s)):
        if s[:i]+s[j:] == 'keyence':
            print('YES')
            exit()
print('NO')
# Judge status: Wrong Answer
import sys
input = sys.stdin.readline
N = int(input())
a = list(map(int, input().split()))
t = 0
f = 0
for x in a:
  if x % 4 == 0: f += 1
  elif x % 2 == 0: t += 1
if N == 1:
  if f: print("Yes")
  else: print("No")
  exit(0)
if N == t:
  print("Yes")
  exit(0)
if (N - (t // 2)) // 2 <= f: print("Yes")
else: print("No")
# Judge status: Wrong Answer
a,b,c,k = map(int, input().split())

ans = a - b

if(k % 2 == 1):
    ans = abs(ans)

print(ans)
# Judge status: Wrong Answer
N, K = map(int, input().split())
H = list(map(int, input().split()))
dp = [1 << 62] * N
dp[0] = 0
for i in range(1, N):
    for j in range(i, min(i + 1 + K, N)):
        cost = abs(H[i - 1] - H[j])
        dp[j] = min(dp[j], dp[i - 1] + cost)
print(dp[-1])
# Judge status: Accepted
import math

N, X, T = map(int, input().split())

t = int(math.ceil(N/X))

print('{}'.format(t*T))
# Judge status: Accepted
a = int(input())
s = input()
print(s if a>3199 else 'red')
# Judge status: Accepted
N = int(input())
S = str(input())

from collections import Counter
freq = Counter(S)

div = int(1e9 + 7)
total = 1
for c in freq.keys():
  #print(c, freq[c])
  total = total * (freq[c] + 1) % div

ans = total - 1
print(ans)
# Judge status: Accepted
s = input()
t = input()

n = len(t)
if s == t[:n-1]:
    print('Yes')
else:
    print('No')
# Judge status: Accepted
L = int(input())

print((L / 3) ** 3)
# Judge status: Accepted
from collections import Counter

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

l = Counter(lines)

l = {k:v for k,v in l.items() if v>=2}

if len(l.keys()) <= 1:
  print(0)
else:
  anss = list(l.keys())
  ma  = max(anss)
  ma2 = sorted(anss)[-2]
  print(ma * ma2 if l[ma] < 4 else ma ** 2)
# Judge status: Accepted
N = int(input())
P = [int(x) for x in input().split()]

m = P[0]
ans = 0
for p in P:
  if p <= m:
    ans += 1
   
  m = min(m, p)
  
print(ans)
# Judge status: Accepted
X = input()
Tnum = len(X) // 2
Snum = len(X) // 2
num = 0
ans = 0
for i in X:
    if i == 'T':
        num -= 1
        Tnum -= 1
    else:
        num += 1
        Snum -= 1

    if num < 0:
        ans += 1
        num = 0
print(ans*2)
# Judge status: Accepted
import heapq

X,Y,A,B,C=map(int,input().split())
p=list(map(int,input().split()))
q=list(map(int,input().split()))
r=list(map(int,input().split()))
p.sort(reverse=True)
q.sort(reverse=True)
r.sort()

s = p[:X]+q[:Y]
ans=sum(s)
heapq.heapify(s)

while r and s:
    if s[0]<r[-1]:
        ans += r[-1]
        r.pop()
        ans -= heapq.heappop(s)
    else:
        break
print(ans)
# Judge status: Accepted
n = int(input())
s = list(input())
ans = 0
 
for i in range(1, n - 1):
    x = set(s[:i])
    y = set(s[i:])
    ans = max(ans, len(x & y))
 
print(ans)
# Judge status: Accepted
N, *A = map(int, open(0).read().split())
mod = 10**9 + 7
 
ans = 0
for i in range(60):
    mask = 1 << i
    cnt = 0
    for a in A:
        if a & mask:
            cnt += 1
    x = cnt * (N-cnt)
    x *= mask % mod
    ans += x
    ans %= mod
 
print(ans)
# Judge status: Accepted
r = int(input())
print(int(r**2))
# Judge status: Accepted
n = int(input())
s = list(input())
rcnt = s[1:].count("E")
lcnt = 0
ans = rcnt
for i in range(1,n):
    if s[i-1] == "W":
        lcnt += 1
    if s[i] == "E":
        rcnt -= 1
    ans = min(ans,lcnt+rcnt)
print(ans)
# Judge status: Wrong Answer
n = int(input())
h = list(map(int, input().split()))
c = []
for i in range(n-2):
  d = abs(h[i]-h[i+1])
  e = abs(h[i]-h[i+2])
  c.append(min(d,e))
  i+=1
print(sum(c))
# Judge status: Wrong Answer
n=int(input())

x=[]
y=[]

for i in range(n):
  s,t=map(int,input().split())
  x.append(s+t)
  y.append(abs(s-t))

print(max(max(x)-min(x),max(y)-min(y)))
# Judge status: Wrong Answer
x = int(input())

divided_11 = x // 11
check_num = divided_11 * 11
ans = divided_11 * 2

while True:
    check_num += 6
    ans += 1
    if check_num >= x:
        print(ans)
        break
    check_num += 5
    ans += 1
    if check_num >= x:
        print(ans)
        break
# Judge status: Accepted
n,m=map(int,input().split())
li=[]
city_counter = [1] * (10**5+2)
ans=[]

for i in range(m):
    p,y=map(int,input().split())
    li.append((p,y,i))

li.sort(key=lambda x:x[1])

for i in range(m):
    tmp = str(li[i][0]).zfill(6) + str(city_counter[li[i][0]]).zfill(6)
    ans.append((tmp,li[i][2]))
    city_counter[li[i][0]] += 1

ans.sort(key=lambda x:x[1])

for i in range(m):
    print(ans[i][0])
# Judge status: Wrong Answer
s = input()

res = 0

for i in range(3):
  if s[i] == 1:
    res += 1
    
print(res)
# Judge status: Accepted

n,m=map(int,input().split())
a1=set()
an=set()
for i in range(m):
    ai,bi=map(int,input().split())
    if ai==1:
        a1.add(bi)
    elif bi==n:
        an.add(ai)

if len(a1&an)==0:
    print("IMPOSSIBLE")
else:
    print("POSSIBLE")
# Judge status: Accepted
S = list(input())
if len(set(S)) == len(S):
    print('yes')
else:
    print('no')
# Judge status: Accepted
from fractions import gcd
N = int(input())
A=list(map(int,input().split()))
L=[0]*N
R=[0]*N
M=[0]*N
L[0]=A[0]
R[-1]=A[-1]
for i in range(1,N):
  L[i]=gcd(L[i-1],A[i])
  R[-i-1]=gcd(R[-i],A[-i-1])
for i in range(N):
  if i == 0:
    M[i]=R[i+1]
  elif i == N-1:
    M[i]=L[i-1]
  else:
    M[i]=gcd(L[i-1],R[i+1])
print(max(M))
# Judge status: Accepted
from collections import defaultdict
N, M = map(int, input().split())
d = defaultdict(int)
for i in range(N):
  A = list(map(int, input().split()))
  for i in range(1, A[0]+1):
    d[A[i]] += 1
ans = 0
for v in d.values():
  if v == N:
    ans += 1
print(ans)
# Judge status: Accepted
c = [[0]*10 for i in range(10)]
for i in range(1,int(input())+1):
  i = str(i)
  c[int(i[0])][int(i[-1])] += 1
ans = 0
for i in range(10):
  for j in range(10):
    ans += c[i][j]*c[j][i]
print(ans)
# Judge status: Accepted
#!/usr/bin/env python3

a, b, c = [int(x) for x in input().split()]
print("Yes" if a <= c <= b or b <= c <= a else "No")
# Judge status: Accepted
import itertools
import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    n=int(input())
    a=tuple(map(int, input().split()))
    b=tuple(map(int,input().split()))
    l=list(itertools.permutations(range(1,n+1)))
    aa=l.index(a)
    bb=l.index(b)
    print(abs(aa-bb))
resolve()
# Judge status: Accepted
import collections

N = int(input())
sequence = list(map(int, input().split()))
CTR = collections.Counter(sequence).most_common()
ans = 0

for i in range(len(CTR)):
    cnt = CTR[i][1]
    obj = int(CTR[i][0])

    if (obj > cnt):
        ans += cnt
    
    else:
        ans += cnt - obj
    
print(ans)
# Judge status: Accepted
import sys
n, m = map(int, input().split())
a = [list(input()) for i in range(n)]
b = [list(input()) for i in range(m)]
for i in range(n-m+1):
  for j in range(n-m+1):
    flag = False
    tmp = [a[f][j:j+m] for f in range(i, i+m)]
    for k in range(m):
      for l in range(m):
        if tmp[k][l] != b[k][l]:
          flag = True
          break
      if flag:
        break
    if flag:
      continue
    print("Yes")
    sys.exit()
print("No")
# Judge status: Wrong Answer
A, B, K = map(int, input().split())

l = range(A, B+1)
a = [n for n in l[:K]]
b = [n for n in l[-K:]]

for n in set(a + b):
    print(n)
# Judge status: Accepted
s = input()

k = s[::-1]

for i in range(len(s)):
    if s[i]=='Z':
        z_num = i 
    if k[i]=='A':
        a_num = i

ans = a_num + z_num + 2 - len(s)

print(ans)
# Judge status: Accepted
n = int(input())
AL = list(map(int, input().split()))
BL = list(map(int, input().split()))
ans = 0
for i in range(n):
    if BL[i] <= AL[i]:
        ans += BL[i]
    elif BL[i] > AL[i] and BL[i] <= AL[i]+AL[i+1]:
        ans += BL[i]
        AL[i+1] = AL[i+1] - BL[i] + AL[i]
    else:
        ans += AL[i]+AL[i+1]
        AL[i+1] = 0
print(ans)
# Judge status: Accepted
N = int(input())
SP = [[0]*3 for i in range(N)]
for i in range(N):
    S,P = map(str,input().split())
    SP[i][0] = S
    SP[i][1] = int(P)*-1
    SP[i][2] = i+1
SP = sorted(SP)
for i in range(N):
	print(SP[i][2])
# Judge status: Wrong Answer
n,wmax = map(int,input().split())
dp = [[0 for ww in range(wmax+1)] for i in range(n+1)]

w,v = [],[]
for i in range(n):
    ww,vv = map(int,input().split())
    w.append(ww)
    v.append(vv)

print(dp[0][0]+2)

for i in range(n):
    for ww in range(wmax+1):
        dp[i+1][ww] = dp[i][ww] if w[i]>ww else max(dp[i][ww], dp[i][ww-w[i]]+v[i])

ans = dp[n][wmax]
print(ans)
# Judge status: Wrong Answer
degree = int(input())
max_num = 360

if(1 <= degree <= 179):
    answer = max_num / degree
    print(answer)
else:
    print('out of range')
# Judge status: Accepted
import sys
sys.setrecursionlimit(10**6)

s=input()
t=input()

for i in range(len(s)):
    u=""
    for j in range(len(s)):
        u+=s[j-i]
#    print(u)
    if(u==t):
        print("Yes")
        exit()
    
print("No")

#print(s[0])
#print(t[0])
# Judge status: Accepted
import itertools

n = int(input())
p = tuple(map(int, input().split()))
q = tuple(map(int, input().split()))
if p == q:
  print(0)
  exit()
nums = [i for i in range(1,n+1)]
a = [0,0]
now = 0
for k,i in enumerate(itertools.permutations(nums)):
  if i == p or i == q:
    a[now] = k
    now += 1
print(abs(a[1]-a[0]))
# Judge status: Wrong Answer

n = int(input())
import collections
chk = collections.deque([])
for i in range(n):
  s = input()
  s = sorted(s)
  chk.append(''.join(s))
#chk = list(chk)
c = collections.Counter(chk)
c = dict(c)
ans = 0
for i in c.values():
  if i == 1:
    break
  else:
    ans += i*(i-1)//2
print(ans)
# Judge status: Accepted
a, b = map(int, input().split())
if a*b % 2 == 0:
    print("Even")
else:
    print("Odd")
# Judge status: Accepted
n,M=map(int,input().split())
l,r,ans=0,10**18,-1
while(l<=r):
    m=(l+r)//2
    ns=max(0,m-n)
    uc=(2*ns+2*m)
    if(uc<=M):
        ans=m
        l=m+1
    else:
        r=m-1
print(ans)
# Judge status: Accepted
def i():
	return int(input())
def i2():
	return map(int,input().split())
def s():
	return str(input())
def l():
	return list(input())
def intl():
	return list(int(k) for k in input().split())

k = i()
ans = 0
ls = list(int(k) for k in range(1,k+1))
for i in range(k):
	ans += ls[i]//2
print(ans)
# Judge status: Accepted
s=input()
print((len(s)-s[::-1].index('Z'))-s.index('A'))
# Judge status: Accepted
n = int(input())
t, a = map(int, input().split())
h = list(map(int, input().split()))

tmp = 10**7
for i in range(n):
    c = abs(a-(t-h[i]*0.006))
    if c < tmp:
        tmp = c
        ans = i+1
print(ans)
# Judge status: Accepted
n=int(input())
x=list(map(int,input().split()))
d={}
for a in x:
    if a in d:
        d[a]+=1
    else:
        d[a]=1
    if a+1 in d:
        d[a+1]+=1
    else:
        d[a+1]=1
    if a-1 in d:
        d[a-1]+=1
    else:
        d[a-1]=1
print(max(d.values()))