Harryxun/sft_time huggingface dataset:
### BUGGY CODE ###

N,X = list(map(int,input().strip().split()))
num = "1"

if N == 0:
    ans = "1"
else:
    for i in range(N):
        ans = "0"+num+"1"+num+"0"
        num = ans

alist = [i for i in str(ans)]
ans_list = list(map(int,alist))

print(sum(ans_list[-X:]))

### FIXED CODE ###

N,X = map(int,input().split())
alist = [2**(i+2)-3 for i in range(N+1)]
cntlist = [2**(i+1)-1 for i in range(N+1)]
cnt = 0
i = 0

while True:
    i += 1
    if X <= N-i+1:
        break
    elif alist[-i] - (N-i+1) <= X:
        cnt += cntlist[-i]
        break
    elif alist[-i]//2 +1 < X: # 左
        cnt += cntlist[-i]//2 +1
        X -= alist[-i]//2 +1
    elif X == alist[-i]//2 +1: # 真ん中
        cnt += cntlist[-i]//2 + 1
        break
    elif X < alist[-i]//2 +1: # 右
        X -= 1

print(cnt)
### BUGGY CODE ###

# ABC084C - Special Trains
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    arr = tuple(tuple(map(int, input().split())) for _ in range(n - 1))
    for i in range(n - 1):
        cur = 0
        for j in range(i, n - 1):
            m, f, s = arr[j]  # move, first train, space (interval)
            if cur <= f:
                cur = f + m
            else:
                t = f  # next train to ride
                while t < cur:
                    t += s
                cur = t + m
        print(cur)
    print(0)


if __name__ == "__main__":
    main()

### FIXED CODE ###

# ABC084C - Special Trains
import sys
input = sys.stdin.readline

def main():
    n = int(input())
    arr = tuple(tuple(map(int, input().split())) for _ in range(n - 1))
    for i in range(n):
        cur = 0
        for c, s, f in arr[i:]:
            if cur <= s:
                cur = s + c
            else:
                cur = (cur + f - 1) // f * f + c
        print(cur)


if __name__ == "__main__":
    main()
### BUGGY CODE ###

N, C = map(int, input().split())

channels = [[] for _ in range(C)]
maxT = 0

for _ in range(N) :
    s, t, c = map(int, input().split())
    maxT = max(maxT, t)
    channels[c - 1].append((s, t))

maxT = maxT * 2 + 10
tvSum = [0 for _ in range(maxT)]

for tv in channels :
    imos = [0 for _ in range(maxT)]
    for (s, t) in tv :
        imos[s * 2 - 1] += 1
        imos[t * 2] -= 1
    for i in range(1, maxT) :
        imos[i] += imos[i - 1]
    for i in range(maxT) :
        if imos[i] > 0 :
            tvSum[i] += 1

ans = 0
for i in range(maxT) :
    ans = max(ans, tvSum[i])

print(ans)


### FIXED CODE ###

N, C = map(int, input().split())

channels = [[] for _ in range(C)]
maxT = 0

for _ in range(N) :
    s, t, c = map(int, input().split())
    maxT = max(maxT, t)
    channels[c - 1].append((s, t))

maxT = maxT * 2 + 10
tvSum = [0 for _ in range(maxT)]

for tv in channels :
    imos = [0 for _ in range(maxT)]
    for (s, t) in tv :
        imos[s * 2 - 1] += 1
        imos[t * 2] -= 1
    for i in range(1, maxT) :
        imos[i] += imos[i - 1]
    for i in range(maxT) :
        if imos[i] > 0 :
            tvSum[i] += 1

print(max(tvSum))
### BUGGY CODE ###

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


def query(lamps):
    counts = [0] * n
    for idx, power in enumerate(lamps):
        start, end = idx - power, idx + power
        if start < 0:
            start = 0
        counts[start] += 1

        if end >= n-1:
            continue
        counts[end+1] -= 1

    now = 0
    for idx, count in enumerate(counts):
        now += count
        lamps[idx] = now


def full_check(counts, full):
    for count in counts:
        if count == full:
            continue
        else:
            return False

    return True


for _ in range(k):
    query(A)
    if full_check(A, n):
        break

print(*A)


### FIXED CODE ###

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


def query(lamps):
    start_list = []
    end_list = []
    for idx, power in enumerate(lamps):
        start, end = idx - power, idx + power
        start_list.append(start)
        end_list.append(end)

    start_list.sort(reverse=True)
    end_list.sort(reverse=True)

    now = 0
    for idx in range(n):
        while start_list and start_list[-1] <= idx:
            start_list.pop()
            now += 1

        while end_list and end_list[-1] < idx:
            end_list.pop()
            now -= 1

        lamps[idx] = now


def full_check(counts, full):
    for count in counts:
        if count == full:
            continue
        else:
            return False

    return True


for _ in range(k):
    query(A)
    if full_check(A, n):
        break

print(*A)
### BUGGY CODE ###

from scipy.sparse import lil_matrix
from scipy.sparse.csgraph import connected_components


class People:
    def __init__(self):
        self.frends = []
        self.blocks = []


n, m, k = [int(i) for i in input().split()]

frends = lil_matrix((n + 1, n + 1), dtype=int)
peoples = [People() for i in range(n + 1)]

for i in range(m):
    one, two = [int(j) for j in input().split()]
    frends[one, two] = 1
    frends[two, one] = 1
    peoples[one].frends.append(two)
    peoples[two].frends.append(one)
num, labels = connected_components(frends)
labels=list(labels)

for i in range(k):
    one, two = [int(j) for j in input().split()]
    if labels[one] == labels[two]:
        peoples[one].blocks.append(two)
        peoples[two].blocks.append(one)

renketu_num = [0]
for i in range(1, num + 1):
    renketu_num.append(labels.count(i))


def get_renketu_num(i):
    return renketu_num[labels[i]] - 1


def get_friend_num(i):
    return len(peoples[i].frends)


def get_block_num(i):
    return len(peoples[i].blocks)


for i in range(1, n + 1):
    print(get_renketu_num(i) - get_friend_num(i) - get_block_num(i))


### FIXED CODE ###

import numpy as np
from scipy.sparse.csgraph import connected_components
from scipy.sparse import csr_matrix

import sys
sys.setrecursionlimit(10**9)
n,m,k=[int(i) for i in input().split()]
frends_num=[0 for i in range(n)]
def make_frends(m,n):
    data=[1 for i in range(m)]

    row=[]
    col=[]
    for k in range(m):
        i,j=[int(l) for l in input().split()]
        new_i=min(i,j)-1
        new_j=max(i,j)-1
        row.append(new_i)
        col.append(new_j)
        frends_num[new_i]+=1
        frends_num[new_j]+=1
    frend_sparce_matrix=csr_matrix((data, (row, col)),shape=(n,n))
    return frend_sparce_matrix


frends=make_frends(m,n)
l,labels=connected_components(frends)
labels
labels=list(labels)

class Group:
    def __init__(self,labels):
        self.labels=labels
        self.group_num=[0 for i in range(l)]
        for i in labels:
            self.group_num[i]+=1
    def get_group_num(self,i):
        return self.group_num[self.labels[i]]

group=Group(labels)


def get_frend_num(i):
    return frends_num[i]


def make_block(k,n):
    block_num=[0 for i in range(n)]
    for p in range(k):
        i,j =[int(l)-1 for l in input().split()]
        new_i=min(i,j)
        new_j=max(i,j)
        if labels[new_i]==labels[new_j]:
            block_num[i]+=1
            block_num[j]+=1
    return block_num

block=make_block(k,n)

def get_block_num(i):
    return block[i]

ans=[]
for i in range(n):
    ans.append(str(group.get_group_num(i)-1-get_frend_num(i)-get_block_num(i)))
print(" ".join(ans))
### BUGGY CODE ###

from bisect import bisect_right,bisect_left
import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
ap,an=[],[]
zeronum=0
for i in range(n):
  if a[i]>0:
    ap.append(a[i])
  elif a[i]<0:
    an.append(-a[i])
  else:
    zeronum+=1
an.sort()
ap.sort()
np,nn=len(ap),len(an)
if np*nn<k<=np*nn+zeronum*(zeronum-1)//2+zeronum*(np+nn):
  print(0)
else:
  #print(ap)
  #print(an)
  if k<=np*nn:
    ng=10**18
    ok=0
    while ng-ok>1:
      mid=(ok+ng)//2
      cnt=0
      for i in range(nn):
        if mid%an[i]!=0:
          cnt+=np-bisect_left(ap,mid//an[i]+1)
        else:
          cnt+=np-bisect_left(ap,mid//an[i])
      #print(cnt)
      if cnt>=k:
        ok=mid
      else:
        ng=mid
    print(-ok)
  else:
    k-=np*nn+zeronum*(zeronum-1)//2+zeronum*(np+nn)
    #print(k)
    ok=10**18
    ng=0
    #print(ok,ng)
    while ok-ng>1:
      mid=(ok+ng)//2
      cnt1,cnt2=0,0
      if np>=2:
        for i in range(np):
          cnt1+=bisect_right(ap,mid//ap[i])
          if ap[i]**2<=mid:
            cnt1-=1
      if nn>=2:
        for i in range(nn):
          cnt2+=bisect_right(an,mid//an[i])
          if an[i]**2<=mid:
            cnt2-=1
      if cnt1//2+cnt2//2>=k:
        ok=mid
      else:
        ng=mid
    print(ok)

### FIXED CODE ###

import sys
input=sys.stdin.readline
n,k=map(int,input().split())
a=list(map(int,input().split()))
ap,an=[],[]
zeronum=0
for i in range(n):
  if a[i]>0:
    ap.append(a[i])
  elif a[i]<0:
    an.append(-a[i])
  else:
    zeronum+=1
np,nn=len(ap),len(an)
def fminus(x):
  j=0
  cnt=0
  for i in range(np):
    cnt+=j
    while j<nn and an[j]*ap[i]>=x:
      j+=1
      cnt+=1
  return cnt
def fplus(x,length,lis):
  r=length-1
  cnt=0
  for l in range(length):
    while lis[r]*lis[l]>x:
      if r==l:
        break
      r-=1
    if r==l:
      break
    elif lis[r]*lis[l]<=x:
      cnt+=r-l
  return cnt
if np*nn<k<=np*nn+zeronum*(zeronum-1)//2+zeronum*(np+nn):
  print(0)
else:
  #print(ap)
  #print(an)
  if k<=np*nn:
    an.sort(reverse=True)
    ap.sort()
    ng=10**18
    ok=0
    while ng-ok>1:
      mid=(ok+ng)//2
      if fminus(mid)>=k:
        ok=mid
      else:
        ng=mid
    print(-ok)
  else:
    an.sort()
    ap.sort()
    k-=np*nn+zeronum*(zeronum-1)//2+zeronum*(np+nn)
    #print(k)
    ok=10**18
    ng=0
    #print(ok,ng)
    while ok-ng>1:
      mid=(ok+ng)//2
      if fplus(mid,nn,an)+fplus(mid,np,ap)>=k:
        ok=mid
      else:
        ng=mid
    print(ok)
### BUGGY CODE ###

n = int(input(''))
adl = input('')

a = list(map(int,adl.split(' ')))

number = 0

mod = 7+1000000000

amari = 0



for i in range(n):
    aa = 0
    for e in range(n-i-1):
        j = i+e+1
        if i != j:
            aa = aa + a[j]
    number = number + (a[i] * aa)
    if number >= mod:
        number = number - mod
amari = number % mod
print(amari)


### FIXED CODE ###

n = int(input(''))
adl = input('')

a = list(map(int,adl.split(' ')))

number = 0

mod = 1000000007

amari = 0

all_a = 0

for i in range(n):
    all_a = all_a + a[i]

for i in range(n):
    all_a = all_a - a[i]
    number = number + (a[i] * all_a)
    number = number % mod
amari = number % mod
print(amari)
### BUGGY CODE ###

from math import factorial

n=int(input())
a=sorted(map(int, input().split()), reverse=True)

his = {}
def fac(n):
	if n not in his:
		his[n] = factorial(n)
	return his[n]

def C(n, r):
	return fac(n) // fac(r) // fac(n-r)

ix = 1
vx = C(a[0], a[1])

for i in range(1, n):
	if vx < C(a[0], a[i]):
		ix = i
		vx = C(a[0], a[i])

print("%d %d" % (a[0], a[ix]))


### FIXED CODE ###

n=int(input())
a=list(map(int, input().split()))
b=max(a)
_,c=min([(abs(b/2-x), x) for x in a])
print("%d %d" % (b, c))
### BUGGY CODE ###

_n = int(input())
_records = list(map(int, input().split()))
_order = []
_rank = 1
while len(_order) < _n:
  for _i in range(_n):
    if _records[_i] == _rank:
      _order.append(_i + 1)
      _rank = _rank + 1
      
print(" ".join(map(str, _order)))

### FIXED CODE ###

_n = int(input())
_records = list(map(int, input().split()))
_order = [0] * _n
_rank = 1
for _i in range(_n):
  _order[_records[_i] - 1] = _i + 1
      
print(" ".join(map(str, _order)))
### BUGGY CODE ###

import sys;      from decimal import Decimal
import math;     from itertools import combinations, product
import bisect;   from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

def binary_search(n, a):
    right = max(a) + 10 ** 9
    left = min(a) - 10 ** 9

    def calc(b):
        score = 0
        for i in range(n):
            score += abs(a[i] - (b + i + 1))
        return score

    while right - left > 1:
        middle = (right + left) // 2
        if calc(middle) < calc(middle + 1):
            right = middle
        else:
            left = middle
    
    return calc(right)

def Main():
    n = read_int()
    a = read_int_list()
    
    print(binary_search(n, a))
    

if __name__ ==  '__main__':
    Main()

### FIXED CODE ###

import sys;      from decimal import Decimal
import math;     from itertools import combinations, product
import bisect;   from collections import Counter, deque, defaultdict

# sys.setrecursionlimit(10 ** 6)
MOD = 10 ** 9 + 7
INF = 10 ** 9
PI = 3.14159265358979323846

def read_str():      return sys.stdin.readline().strip()
def read_int():      return int(sys.stdin.readline().strip())
def read_ints():     return map(int, sys.stdin.readline().strip().split())
def read_str_list(): return list(sys.stdin.readline().strip().split())
def read_int_list(): return list(map(int, sys.stdin.readline().strip().split()))
def lcm(a: int, b: int) -> int: return (a * b) // math.gcd(a, b)

import numpy as np
from numba import i8, njit

#AOTにするとさらに早くなる?
@njit(i8(i8, i8[:]), cache=True)
def binary_search(n, a):
    right = np.max(a) + 10 ** 9
    left = np.min(a) - 10 ** 9

    def calc(b):
        score = 0
        for i in range(n):
            score += abs(a[i] - (b + i + 1))
        return score

    while right - left > 1:
        middle = (right + left) // 2
        if calc(middle) < calc(middle+1):
            right = middle
        else:
            left = middle
    
    return calc(right)

def Main():
    n = read_int()
    a = np.array(read_int_list(), dtype=np.int64)
    
    print(binary_search(n, a))

if __name__ ==  '__main__':
    Main()
### BUGGY CODE ###

#!usr/bin/env python3
#-*- coding: utf-8 -*-
# E-LRU Puzle
def reads(offset = 0):
	return [int(i) - offset for i in input().split(' ')]
#Data input
(N, M) = reads()
Q = int(input())
A = reads(1)

#Data structure initial
pos = [-1] * M
pat = []
freq = [0] * (M+1)
freq[0] = N

#Pattern search & Match count
counter = 0
for i in A[::-1]:
	if (i not in pat):
		pat.append(i)
		pos[i] = counter
		freq[counter] -= 1
		counter += 1
		freq[counter] += 1
	else:
		temp = pos[i]
		if (freq[temp] > 0):
			freq[temp] -= 1
			freq[temp+1] += 1

if(counter != M):
	for i in range(M):
		if (i not in pat):
			pat.append(i)

#Result judge
for i in range(M):
	if (freq[i] != 0):
		start = i
		break

p = pat[start:]
p.sort()
if(p == pat[start:]):
	print("Yes")
else:
	print("No")


### FIXED CODE ###

def reads(offset = 0):
	return [int(i) - offset for i in input().split(' ')]
def Judge(vector):
	length = len(vector)-1
	for i in range(length):
		if(vector[i] > vector[i+1]):		
			return 0
	return 1
(N, M) = reads()
Q = int(input())
A = reads(1)
pos = [-1] * M
pat = []
freq = [0] * (M+1)
freq[0] = N
found = set()
counter = 0
for i in A[::-1]:
	if (i not in found):
		pat.append(i)
		found.add(i)
		pos[i] = counter
		counter += 1
		if(counter == M):
			break
for i in range(M):
	if (pos[i] == -1):
		pat.append(i)	
for i in A[::-1]:
	temp = pos[i]
	if (freq[temp] > 0):
		freq[temp] -= 1
		freq[temp+1] += 1
start = M
for i in range(M):
	if (freq[i] != 0):
		start = i
		break
print("Yes") if Judge(pat[start:]) else print("No")
### BUGGY CODE ###

(n, m) = list(map(int, input().split()))
p = list(map(int, input().split()))
cG = []
for i in range(0, m):
    e = list(map(int, input().split()))
    aru = False
    do = []
    for c in cG:
        if e[0] in c or e[1] in c:
            if not do == []:
                mix = do + c
                cG.remove(do)
                cG.remove(c)
                cG.append(mix)
                break
            else:
                do = c
        if e[0] in c:
            aru = True
            c.append(e[1])
        if e[1] in c:
            aru = True
            c.append(e[0])
    if not aru:
        cG.append(e)

res = 0
for i in range(1, n + 1):
    cc = False
    for c in cG:
        if i in c:
            cc = True
            break
    if not cc:
        if p[i - 1] == i:
            res = res + 1

for i in range(1, n + 1):
    for c in cG:
        if i in c:
            ku = p.index(i) + 1
            if ku in c:
                res = res + 1
print(res)


### FIXED CODE ###

def ge(x):
    return int(x) - 1


(n, m) = tuple(map(int, input().split()))
inp = list(map(ge, input().split()))
arr = [i for i in range(n)]


def root(a):
    global arr
    if arr[a] == a:
        return a
    else:
        tmp = root(arr[a])
        arr[a] = tmp
        return tmp


def sameroot(x, y):
    return root(x) == root(y)


def merge(x, y):
    global arr
    if not sameroot(x, y):
        arr[root(y)] = root(x)


for i in range(m):
    merge(*tuple(map(ge, input().split())))

res = 0
for i in range(n):
    if sameroot(i, inp[i]):
        res += 1
print(res)
### BUGGY CODE ###

N = int(input())
x = []
for i in range(N):
    a1,b1,c1,d1=[int(i) for i in input().split()]
    x.append([a1,b1,c1,d1])
for i in range(N):
  y = x[i]
  if y[0] < y[1]:
    print("No")
  elif y[1] > y[3]:
    print("No")
  elif y[1] > y[2]:
    ama = y[0] % y[1]
    mo = y[3] %  y[1]
    if mo == 0:
      if ama<= y[2]:
        print("Yes")
      else:
          print("No")
    elif mo <= y[1]-y[2]-1:
      print("No")
    else:
        to = y[1] % mo
        if to == 0:
          if ama<= y[2]:
            print("Yes")
          else:
              print("No")
        else:
          i = 0
          while True:
            if i >= to:
              print("Yes")
              break
            ama = (ama +y[1])%mo
            if ama <= y[1]-y[2]-1:
              print("No")
              break
            i+=1
  else:
    print("Yes")

### FIXED CODE ###

import fractions
N = int(input())
x = []
for i in range(N):
    a1,b1,c1,d1=[int(i) for i in input().split()]
    x.append([a1,b1,c1,d1])
for i in range(N):
  y = x[i]
  if y[0] < y[1]:
    print("No")
  elif y[1] > y[3]:
    print("No")
  elif y[1] > y[2]:
    ama = y[0] % y[1]
    mo = y[3] %  y[1]
    if mo == 0:
      if ama<= y[2]:
        print("Yes")
      else:
          print("No")
    elif mo <= y[1]-y[2]-1:
      print("No")
    else:
        to = y[1] % mo
        if to == 0:
          if ama<= y[2]:
            print("Yes")
          else:
              print("No")
        else:
          are = fractions.gcd(to, y[1])
          if are <= y[1]-y[2]-1:
            print("No")
          else:
            print("Yes")
          
  else:
    print("Yes")
### BUGGY CODE ###

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

original_w = []
prev = 0
for i in range(N):
    if S[i] == 'W':
        prev += 1
    original_w.append(prev)

original_e = []
prev = 0
for i in range(N - 1, -1, -1):
    if S[i] == 'E':
        prev += 1
    original_e.insert(0, prev)

print(min([original_w[i - 1] + original_e[i + 1] for i in range(1, N - 1)] + [original_e[1], original_w[N - 2]]))


### FIXED CODE ###

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

original_w = []
prev = 0
for i in range(N):
    if S[i] == 'W':
        prev += 1
    original_w.append(prev)

original_e = []
prev = 0
for i in range(N - 1, -1, -1):
    if S[i] == 'E':
        prev += 1
    original_e.append(prev)

ans = min(original_e[N - 1], original_w[N - 2])
for i in range(1, N - 1):
    ans = min(ans, original_w[i - 1] + original_e[N - (i + 1)])
print(ans)
### BUGGY CODE ###

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

for _ in range(min(k,100)):
    s=[0 for _ in range(n)]
    e=[0 for _ in range(n)]
    for i in range(n):
        d=a[i]
        s[max(0,i-d)]+=1
        e[min(n-1,i+d)]+=1
    a[0]=s[0]
    for i in range(1,n):
        s[i]=s[i-1]+s[i]
        e[i]=e[i-1]+e[i]
        a[i]=s[i]-e[i-1]

print(*a)

### FIXED CODE ###

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

for _ in range(min(k,100)):
    s=[0 for _ in range(n)]
    e=[0 for _ in range(n)]
    for i in range(n):
        d=a[i]
        s[max(0,i-d)]+=1
        e[min(n-1,i+d)]+=1
    a[0]=s[0]
    for i in range(1,n):
        s[i]=s[i-1]+s[i]
        e[i]=e[i-1]+e[i]
        a[i]=s[i]-e[i-1]

print(*a)
### BUGGY CODE ###

import math

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

ans = 1
for num in range(N):
    ans *= A[num]

if ans > math.pow(10, 18):
    print(-1)
else:
    print(ans)

### FIXED CODE ###

import math

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

ans = 1
for num in range(N):
    ans *= A[num]
    if ans > math.pow(10, 18):
        ans = -1
        break

if 0 in A:
    ans = 0

print(ans)
### BUGGY CODE ###

from collections import deque

N, M = map(int, input().split())
g = [[] for i in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    g[A-1].append(B)
    g[B-1].append(A)

ans = [-1] * N
ans[0] = 0
d = deque([1])
while any(i == -1 for i in ans) and len(d) != 0:
    now = d[0]
    d.popleft()
    for i in g[now-1]:
        if ans[i-1] != -1:
            continue
        ans[i-1] = now
        d.append(i)

if any(i == -1 for i in ans):
    print('No')
else:
    print('Yes')
    for i in ans[1:]:
        print(i)


### FIXED CODE ###

from collections import deque

N, M = map(int, input().split())
g = [[] for i in range(N)]
for i in range(M):
    A, B = map(int, input().split())
    g[A-1].append(B)
    g[B-1].append(A)

ans = [-1] * N
ans[0] = 0
d = deque([1])
while len(d) != 0:
    now = d[0]
    d.popleft()
    for i in g[now-1]:
        if ans[i-1] != -1:
            continue
        ans[i-1] = now
        d.append(i)

if -1 in ans:
    print('No')
else:
    print('Yes')
    for i in ans[1:]:
        print(i)
### BUGGY CODE ###

n=int(input())
S=list(input())

ans=0
for v in range(1000):
  v=str(v).zfill(3)
  idx,cnt=0,0
  for i in range(n):
    if S[i]==v[idx]:
      idx+=1
    else:
      cnt+=1
    if cnt>n-3 or idx>=3:
      break
  if idx>=3:
    ans+=1
print(ans)

### FIXED CODE ###

n=int(input())
S=input()

ans=0
for i in range(10):
  for j in range(10):
    for k in range(10):
      idxi=S.find(str(i))
      if idxi==-1:
        continue
      idxj=S.find(str(j),idxi+1)
      if idxj==-1:
        continue
      idxk=S.find(str(k),idxj+1)
      if idxk==-1:
        continue
      ans+=1
print(ans)
### BUGGY CODE ###

def main():
    N, M, K = map(int, input().split())

    fac = [0] * N
    fac[0] = 1
    for i in range(N - 1):
        fac[i + 1] = fac[i] * (i + 1) % 998244353

    def mcomb(n, k):
        if n == 0 and k == 0:
            return 1
        if n < k or k < 0:
            return 0
        return fac[n] * pow(fac[n - k], 998244351, 998244353) * pow(fac[k], 998244351, 998244353) % 998244353

    result = 0
    for i in range(K + 1):
        result += mcomb(N - 1, i) * pow(M - 1, N - 1 - i, 998244353)
        result %= 998244353
    result *= M
    result %= 998244353
    print(result)


main()


### FIXED CODE ###

N, M, K = map(int, input().split())

result = 0
n = 1
k = 1
for i in range(K + 1):
    result += n * pow(k, 998244353 - 2, 998244353) * pow(M - 1, N - 1 - i, 998244353)
    result %= 998244353
    n *= N - 1 - i
    n %= 998244353
    k *= i + 1
    k %= 998244353
result *= M
result %= 998244353
print(result)
### BUGGY CODE ###

N = int(input())
List = list(map(int, input().split()))
res = 0
A = [[0 for j in range(N)] for i in range(N)]
B = [[0 for j in range(N)] for i in range(N)]
for i in range(N):
  for j in range(N):
    if A[j][i] != 0:
      pass
    else:
      A[i][j] = List[i]+List[j]
      B[i][j] = A[i][j]-abs(j-i)
      if B[i][j] == 0:
        res = res + 1
print(res)

### FIXED CODE ###

n = int(input())
A = list(map(int, input().split()))
m = {}
ans = 0
for i in range(n):
    x = A[i] + i   #i番目と当該数字の和
    if x not in m:
        m[x] = 0   #和の属性値を0とする
    m[x] += 1      #和の属性値に１を足す
    if i - A[i] in m: #i番目と当該数字の差
        ans += m[i - A[i]] #差の位置に当たる属性値を答えに足す
print(ans)