Harryxun/stf_run huggingface dataset:
import math

n = int(input())
d = list(map(int,input().split()))

ans = -1

d_count = [0] * (max(d)+1)
for i in range(n):
  d_count[d[i]] += 1

if d[0] != 0 or d_count[0] != 1:
  print(0)
  exit()

ans = 1
for i in range(1,len(d_count)-1):
  ans = ans *  math.pow(d_count[i], d_count[i+1])

ans = ans % 998244353

print(int(ans))

### FIXED CODE ###

import math

n = int(input())
d = list(map(int,input().split()))

ans = -1

d_count = [0] * (max(d)+1)
for i in range(n):
  d_count[d[i]] += 1

if d[0] != 0 or d_count[0] != 1:
  print(0)
  exit()

ans = 1
for i in range(1,len(d_count)-1):
  for j in range(d_count[i+1]):
    ans = ans * d_count[i]
    ans = ans % 998244353

ans = ans % 998244353

print(int(ans))
x,y,z=map(int,imput().split())
print(z+' '+x+' '+y)


### FIXED CODE ###

x,y,z=map(int,input().split())
print(z,x,y)
S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
    exit()
l = 0
for s in range(len(S)-len(T)+1):
    if S[s]=="?" or S[s] == T[0]:
        k = 0
        for t in range(len(T)):
            if S[s+t]!="?" and S[s+t]!=T[t]:
                break
            else:
                k+=1
    if k==len(T):
        l = s
        break
if k<len(T):
    print("UNRESTORABLE")
else:
    ans = []
    for i in range(len(S)):
        if l <= i and i < i+k:
            ans.append(T[i-l])
        elif S[i]=="?":
            ans.append("a")
        else:
            ans.append(S[i])
    print("".join(ans))

### FIXED CODE ###

S = list(input())
T = list(input())
if len(S)<len(T):
    print("UNRESTORABLE")
else:
    S = S[::-1]
    T = T[::-1]
    k = 0
    l = 0
    for i in range(len(S)-len(T)+1):
        if S[i]=="?" or S[i]==T[0]:
            k = 0
            for j in range(len(T)):
                if S[i+j]=="?" or S[i+j]==T[j]:
                    k+=1
        if k==len(T):
            l = i
            break
    if k!=len(T):
        print("UNRESTORABLE")
    else:
        ans = []
        for i in range(len(S)):
            if l <= i and i < l+k:
                ans.append(T[i-l])
            elif S[i]=="?":
                ans.append("a")
            else:
                ans.append(S[i])
        print("".join(ans[::-1]))
#!/usr/bin/python

import sys


def main():
  length, elements = sys.argv[1].split('\n')
  length = int(length)
  elements = elements.split()
  print(" ".join(elements))
  elements = [str(i) for i in elements]

  sorted_list = [elements[0]]
  for i in range(1, length):
    element = elements[i]
    for j in range(0, len(sorted_list) + 1):
      if j == len(sorted_list):
        sorted_list.append(element)
        break
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
    output_list = sorted_list[0:i+1] + elements[i+1:]
    print(" ".join([str(i) for i in output_list]))

    return 0

if __name__ == '__main__':
  main()

### FIXED CODE ###

#!/usr/bin/python

import sys


def main():
  length = int(input())
  elements = list(map(int, input().split()))
  print(" ".join(str(i) for i in elements))

  sorted_list = [elements[0]]
  for i in range(1, length):
    element = elements[i]
    for j in range(0, len(sorted_list) + 1):
      if j == len(sorted_list):
        sorted_list.append(element)
      elif element < sorted_list[j]:
        sorted_list.insert(j, element)
        break
    output_list = sorted_list[0:i+1] + elements[i+1:]
    print(" ".join([str(i) for i in output_list]))

  return 0

if __name__ == '__main__':
  main()
N, R = map(int, input().split())
if N >= 10:
  print(R)
else:
  print(R - 100 * (10−N)) 

### FIXED CODE ###

N, R = map(int, input().split())
if N >= 10:
  print(R)
else:
  print(R + 100 * (10 - N))
N = int(input())
B = list(map(int,input().split()))
s = B[N-2]+B[0]
for i in range(N-2):
    s+=min(B[i],B[i+1])

print(s)

### FIXED CODE ###

N=int(input())
print(N*N*N)
print(' '+*[i for i in range(3,int(input())+1)if i%3==0 or '3' in str(i)])

### FIXED CODE ###

print('',*[i for i in range(3,int(input())+1)if i%3==0 or'3'in str(i)])
# -*- coding: utf-8 -*-

import os
import datetime

def main():
    a, b = map(int, input().split())
    val = list(map(lambda x: int(x), input().split()))

    result_dict = []

    for i in range(len(val)):
        for j in range(i+1, len(val)):
            result_dict.append(val[i] * val[j])

    min_list = sorted(result_dict)
    print(min_list[b-1])

if __name__ == '__main__':
    main()

### FIXED CODE ###

# -*- coding: utf-8 -*-

import os
import datetime

def main():
    # スペース区切りの整数の入力
    a, b, c = map(int, input().split())
    int_dict = {}
    int_dict[a] = ""
    int_dict[b] = ""
    int_dict[c] = ""

    if len(int_dict) == 2:
        print("Yes")
    else:
        print("No")

if __name__ == '__main__':
    main()
N,S=input()
if N%2==0:
    f,s=S[:int(N/2)], S[int(N/2):]
if f==s:
    print('Yes')
else:
    print('No')

### FIXED CODE ###

N=int(input())
S=input()
f='sf'
s='fs'
if N%2==0 and N!=0:
    f,s=S[:int(N/2)], S[int(N/2):]
if f==s:
    print('Yes')
else:
    print('No')
N,M = map(int,input().split())
a = []
for i in range(M):
    a.append(int(input()))
dp = [0]*(N+1)
dp[1] = 1
if 1 in a:
    dp[2] = 1
    dp[1] = 0
else:
    dp[2] = 2
for i in range(3,N+1):
    if i-1 in a:
        dp[i] = dp[i-2]%1000000007
        dp[i-1] = 0
    else:
        dp[i] = (dp[i-2]+dp[i-1])%1000000007
ans = dp[N]%1000000007
print(ans)


### FIXED CODE ###

N,M = map(int,input().split())
a = set([int(input()) for i in range(M)])
dp = [0]*(N+1)
dp[0] = 1
dp[1] = 1
if 1 in a:
    dp[1] = 0
for i in range(2,N+1):
    if i in a:
        continue
    
    dp[i] = (dp[i-2]+dp[i-1])%1000000007
ans = dp[N]
print(ans)
import math

n, k = input().split()
n = int(n)
k = int(k)
m = n - k

for i in range(1, k+1):
	if m + 1 < i:
		red_order = 0
	else:
		red_order = int(math.factorial(m + 1) / (math.factorial(m + 1 - i) * math.factorial(i)))
	blue_order = int(math.factorial(k - 1) / (math.factorial(k - 1 - (i - 1)) * math.factorial(i - 1)))
	print(red_order*blue_order%(10**9+7))

### FIXED CODE ###

import math

N, K = input().split()
N = int(N)
K = int(K)
m = N - K
mod = 10**9+7

def factorial_m(N: int, M: int):
	res = 1
	for i in range(2, N+1):
		res *= i
		res %= M
	return res

def nCr(n, r, mod):
	if n == r:
		return 1
	elif r > n:
		return 0
	return (factorial_m(n, mod) * pow((factorial_m(n-r, mod) * factorial_m(r, mod)), mod-2, mod)) % mod

for i in range(1, K+1):
	print(nCr(N-K+1, i, mod) * nCr(K-1, i-1, mod) % mod)
a=input()
t=chr(ord(a)+1)
print(t

### FIXED CODE ###

try:
  n=input()
  c=chr(ord(n)+1)
  print(c)
except:
  pass
n=int(input())
x=input()
import sys
sys.setrecursionlimit(10**7)
if n==1:
  print(1 if x=='1' else 0)
  exit()
def pc(x):
  a=bin(x)[2:]
  return a.count('1')
def func(x):
  if x==0:
    return 0
  else:
    return func(x%pc(x))+1
pcx=x.count('1')
if pcx==0:
  for _ in range(n):
    print(1)
else:
  x0,x1=0,0
  
  for i in range(n):
    if x[i]=='1':
      #if pcx!=1:
      x0+=pow(2,n-1-i,pcx-1)
      x0%=pcx-1
      x1+=pow(2,n-1-i,pcx+1)
      x1%=pcx+1
  for i in range(n):
    ans=0
    if x[i]=='1':
      if pcx==1:
        print(0)
      else:
        xx=x0-pow(2,n-1-i,pcx-1)
        xx%=pcx-1
        print(func(xx)+1)
    else:
      xx=x1+pow(2,n-1-i,pcx+1)
      xx%=pcx+1
      print(func(xx)+1)


### FIXED CODE ###

n=int(input())
x=input()
import sys
sys.setrecursionlimit(10**7)
if n==1:
  print(0 if x=='1' else 1)
  exit()
def pc(x):
  a=bin(x)[2:]
  return a.count('1')
def func(x):
  if x==0:
    return 0
  else:
    return func(x%pc(x))+1
pcx=x.count('1')
if pcx==0:
  for _ in range(n):
    print(1)
else:
  x0,x1=0,0
  for i in range(n):
    if x[i]=='1':
      if pcx!=1:
        x0+=pow(2,n-1-i,pcx-1)
        x0%=pcx-1
      x1+=pow(2,n-1-i,pcx+1)
      x1%=pcx+1
  for i in range(n):
    ans=0
    if x[i]=='1':
      if pcx==1:
        print(0)
      else:
        xx=x0-pow(2,n-1-i,pcx-1)
        xx%=pcx-1
        print(func(xx)+1)
    else:
      xx=x1+pow(2,n-1-i,pcx+1)
      xx%=pcx+1
      print(func(xx)+1)
h = [input() for _ in xrange(10)].sort()
h[0:3]

### FIXED CODE ###

hs = [input() for _ in xrange(10)]
hs.sort()
for _ in xrange(3):
    print hs.pop()
import collections

n = int(input())
v = [int(i) for i in input().split()]

v1 = [v[i] for i in range(0,n,2)]
v2 = [v[i] for i in range(1,n,2)]

count1 = collections.Counter(v1)
count2 = collections.Counter(v2)

if v1 == v2:
    print(len(v1))

elif len(count1) == 1 and len(count2) == 1:
    print(0)

else:
    res = 0
    ct1 = list(count1.values())
    ct2 = list(count2.values())

    if len(ct1) != 1:
        for i in ct1[1:]:
            res = res + ct1[i]

    if len(ct2) != 1:
        for i in ct2[1:]:
            res = res + ct2[i]
    print(res)




### FIXED CODE ###

import collections
 
n = int(input())
v = [int(i) for i in input().split()]
 
v1 = [v[i] for i in range(0,n,2)]
v2 = [v[i] for i in range(1,n,2)]
 
count1 = collections.Counter(v1).most_common(2)
count2 = collections.Counter(v2).most_common(2)

if count1[0][0] != count2[0][0]:
    res = len(v1) - count1[0][1] + len(v2) - count2[0][1]
    print(res)
else:
    if len(count1) == 1:
        print(len(v1))
    else:
        res1 = len(v1) - count1[0][1] + len(v2) - count2[1][1]
        res2 = len(v1) - count1[1][1] + len(v2) - count2[0][1]
        print(min(res1,res2))
N = int(input())
A = []
for i in range(N):
   A.append(input())

for i in range(N-1):
     S = 0
     if A[i][-1] == A[i+1][0]:
        S += 1
for i in range(N):
  for j in range(N):
    if i != j:
      if A[i] == A[j]:
        A == 1
      else:
        A == 0

if S == 1 and A == 0:
  print('Yes')
else:

### FIXED CODE ###

N = int(input())
A = []
for i in range(N):
   A.append(input())
S = 0
for i in range(N-1):
    if A[i][-1] == A[i+1][0]:
        S += 1
B = 0
for i in range(N):
    for j in range(N):
        if A[i] == A[j]:
            B += 1
        else:
            B += 0

if S == N-1 and B == N:
    print('Yes')
else:
    print('No')
#coding:utf-8
#1_10_A 2015.4.10
import math

position = list(map(int,input().split()))
distance = math.sqrt((position[2] - position[0]) ** 2 + (position[3] - position[1]) ** 2)
print('{:.5f}'.format(distance))

### FIXED CODE ###

#coding:utf-8
#1_10_A 2015.4.10
import math

x1,y1,x2,y2 = map(float,input().split())
distance = math.sqrt((x2 - x1) ** 2 + (y2 - y1) ** 2)
print('{:.5f}'.format(distance))
n, m = map(int, input().split())

num = set(list(range(1, m + 1)))
for i in range(n):
    in_li = list(map(int, input().split()))
    num = num & set(in_li[1:])
print(len(num))

### FIXED CODE ###

s = input()
result = 'None'
for i in range(26):
    if chr(ord('a')+i) not in s:
        result = chr(ord('a')+i)
        break
print(result)
N,X=(int(i) for i in input().split())
L=[int(i) for i in input().split()]
for i in range(1,N+1):
    if sum(L[:i])>X:
        print(i)
        break

### FIXED CODE ###

X,A=(int(i) for i in input().split())
if X<A:
    print(0)
else:
    print(10)
from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n, q = map(int, readline().split())
  s = input()
  t = [0] *(n=1)
  for i in range(n):
    t[i+1] = t[i] + (a if s[i:i+2] == 'AC' else 0)
  for i in range(q):
    l, r = map(int, readline().split())
    print(t[r-1] - t[l-1])
  
  
if __name__ == '__main__':
  main()

### FIXED CODE ###

from collections import deque
from collections import Counter
from itertools import product, permutations,combinations
from operator import itemgetter
from heapq import heappop, heappush
from bisect import bisect_left, bisect_right, bisect
#pypyではscipy, numpyは使えない
#from scipy.sparse.csgraph import shortest_path, floyd_warshall, dijkstra, bellman_ford, johnson, minimum_spanning_tree
#from scipy.sparse import csr_matrix, coo_matrix, lil_matrix
#import numpy as np
from fractions import gcd
from math import ceil,floor, sqrt, cos, sin, pi, factorial
import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines
sys.setrecursionlimit(10**8)
INF = float('inf')
MOD = 10**9+7

def main():
  n, q = map(int, readline().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])
  
  
if __name__ == '__main__':
  main()
import collections

N = int(input())
co = [list(map(int, input().split())) for i in range(N)]

tmp = []
for i in range(N):
    for j in range(N):
        tmp.append((co[i][0]-co[j][0],co[i][1]-co[j][1]))
c = collections.Counter(tmp)
print(N - c.most_common()[1][1])

### FIXED CODE ###

import collections

N = int(input())
co = [list(map(int, input().split())) for i in range(N)]

if N > 1:
    tmp = []
    for i in range(N):
        for j in range(N):
            tmp.append((co[i][0]-co[j][0],co[i][1]-co[j][1]))
    c = collections.Counter(tmp)
    print(N - c.most_common()[1][1])
else:
    print("1")
import math
r = int(input())

area = r * r * math.pi
length = r * 2 * math.pi

print(area,end=' ')
print(length)

### FIXED CODE ###

import math
r = float(input())

area = r * r * math.pi
length = r * 2 * math.pi

print("{0:.6f}".format(area),end=' ')
print("{0:.6f}".format(length))
a=Y
b=X
c=Z
A=c
B=b
C=a
print(A" "B" "C)

### FIXED CODE ###

X,Y,Z=input().split()
print(Z,X,Y)
import math
tan, tyou, hour, minute = input()
tan_rad = 30 * hour
tyou_rad = 6 * minute
if tan_rad == tyon_rad:
  answer = abs(tyou - tan)
else:
  rad = abs(tan_rad - tyou_rad)
if rad:
  answer = math.sqrt((tan ** 2) + (tyou ** 2) - 2 * tan * tyou * math.sin(math.radius(rad)))
print(answer)

### FIXED CODE ###

import math
ji, hun, H, M = input().split()
ji = int(ji)
hun = int(hun)
H = int(H)
M = int(M)
ji_rad = 30 * H + 0.5 * M
hun_rad = 6 * M
diff = abs(ji_rad - hun_rad)
if diff == 0:
  answer = abs(ji - hun)
elif diff == 180:
  answer = ji + hun
else:
  if diff > 180:
      diff = abs(360 - diff)
  answer = math.sqrt((ji ** 2) + (hun ** 2) - 2 * ji * hun * math.cos(math.radians(diff)))
print(answer)
N = int(input())
A = list(map(int,input().split()))
import fractions
X = A[0]
for i in range(1, N):
    X = X // fractions.gcd(X, A[i]) * A[i] 

output = 0
for i in range(N):
    output += int(X/A[i])%(10**9+7)
    if output > 10**9+7:
        output = output % (10**9+7)
print(output)


### FIXED CODE ###

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

import fractions

X = A[0]
for i in range(1, N):
    X = X*A[i] // fractions.gcd(X, A[i])

output = 0
D =10**9+7
X = X%D

for i in range(N):
    output += X*pow(A[i],D-2,D)%D
    output = output % (10**9+7)
print(int(output))
N = int(input())
    A = [int(i) for i in input().split(" ")]
def bubble(A, N):
    count = 0
    flag = True
    while flag == True:
        flag = False
        for j in range(N-1, 0, -1):
            if A[j] < A[j - 1]:
                A[j -1],A[j] = A[j], A[j - 1]
                count += 1
                flag = True
            print(" ".join(map(str, A)))
            print(count)

print(bubble(A, N))

### FIXED CODE ###

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


def bubble_sort(A, N):
    cnt = 0
    flag = True
    while(flag):
        flag = False
        for i in range(N-1, 0, -1):
            if(A[i-1] > A[i]):
                A[i-1], A[i] = A[i], A[i-1]
                cnt += 1
                flag = True

    print(" ".join(list(map(str, A))))
    print(cnt)

bubble_sort(A, N)
ort sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
A, B = MAP()
 
if A >= 13:
  print(B)
  exit()
if A <= 5:
  print(0)
  exit()
print(B//2)

### FIXED CODE ###

import sys, re
from collections import deque, defaultdict, Counter
from math import ceil, sqrt, hypot, factorial, pi, sin, cos, radians
from itertools import accumulate, permutations, combinations, product
from operator import itemgetter, mul
from copy import deepcopy
from string import ascii_lowercase, ascii_uppercase, digits
from bisect import bisect, bisect_left
from fractions import gcd
from heapq import heappush, heappop
from functools import reduce
def input(): return sys.stdin.readline().strip()
def INT(): return int(input())
def MAP(): return map(int, input().split())
def LIST(): return list(map(int, input().split()))
sys.setrecursionlimit(10 ** 9)
INF = float('inf')
mod = 10 ** 9 + 7
 
A, B = MAP()
 
if A >= 13:
  print(B)
  exit()
if A <= 5:
  print(0)
  exit()
print(B//2)
a = input()
b = input()

x = a+b

if x == int(x):
  print(x)
 
else:
  print(int(x+1)

### FIXED CODE ###

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

x = (a+b)/2
 
if x == int(x):
  print(int(x))
 
else:
  x += 1
  print(int(x))
nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
else a > b;
    print('a > b')
else:
    print('a == b'(

### FIXED CODE ###

nums = input().split()
a = int(nums[0])
b = int(nums[1])
if a < b:
    print('a < b')
elif a > b:
    print('a > b')
else:
    print('a == b')
import numpy as np

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

K_str = format(K, 'b')
max_order = len(K_str)

B = np.array([list(format(a, '0{}b'.format(max_order)))
              for a in A]
             ).astype('i')[:, :max_order]
B = B.sum(axis=0)
B = np.where(B < N/2, 1, 0)

X_str = ''.join(map(str, B))
X = int(X_str, 2)

print(sum(map(lambda a: X ^ a, A)))

### FIXED CODE ###

import numpy as np

N, K = [int(a) for a in input().split()]
A = [int(a) for a in input().split()]

K = format(K, 'b')
B = [format(a, 'b') for a in A]
max_order = len(max(B + [K], key=len))

K = K.zfill(max_order)
B = np.array([list(b.zfill(max_order)) for b in B], dtype='i')
B = B.sum(axis=0)
B = np.where(B < N/2, '1', '0')

for i, k, b in zip(range(max_order), K, B):
    if k < b:
        B[i] = '0'
    elif k > b:
        break

X = int(''.join(map(str, B)), 2)

print(sum(map(lambda a: X ^ a, A)))
from copy import deepcopy
import numpy as np
def factor(N):
    ans = []
    for i in range(1,int(np.sqrt(N))+1):
        if N%i == 0:
            ans.append(i)
            if N//i != i:
                ans.append(i)
    return ans

def check(K,N):
    while N>=K:
        if N%K == 0:
            N = N//K
        else:
            N = N%K
    if N%K == 1:
        return True
    else:
        return False

N = int(input())
ans = len(factor(N-1)[1:])
for K in factor(N)[1:]:
    if check(K,N):
        ans += 1

print(ans)   


### FIXED CODE ###

def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor

def primelist(n):
    is_prime = [True] * (n + 1)
    is_prime[0] = False
    is_prime[1] = False
    for i in range(2, int(n**0.5) + 1):
        if not is_prime[i]:
            continue
        for j in range(i * 2, n + 1, i):
            is_prime[j] = False
    return [i for i in range(n + 1) if is_prime[i]]

def factorization(n):
    plist = primelist(int(n**0.5))
    factor = []
    for p in plist:
        k = 0
        while n%p==0:
            k+=1
            n//=p
        if k>0:
            factor.append((p,k))
        if n==1:
            break
    if n!=1:
        factor.append((n,1))

    return factor

def divisors(n):
    divisors = []
    for i in range(1, int(n**0.5)+1):
        if n % i == 0:
            divisors.append(i)
            if i != n // i:
                divisors.append(n//i)

    # divisors.sort()
    return divisors


def main():
    n = int(input())
    f1 = divisors(n)
    f2 = factorization(n-1)
        
    s = 1
    for f_i in f2:
        s *=(f_i[1]+1)

    for d in f1[1:]:
        t = test(n,d)
        if t==1:
            s+=1

    print(s-1)
    

def test(n,k):

    while n>=k:
        if n%k==0:
            n//=k
        else:
            n%=k
    return n



if __name__ == "__main__":
    main()
import sympy

n = int(input())

ans = 0
for i in range(1, n+1):
    ans += i * sympy.divisor_count(i)
    
print(ans)

### FIXED CODE ###

n = int(input())

ans = 0
for x in range(1, n+1):
    y = n // x
    ans += y * (y+1) * x // 2
    
print(ans)
from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n, k = MI()

h = np.array(sorted([int(i) for i in input().split()]))
hmax = h.max()

if k >= len(h):
    print(0)
    exit()

h = np.delete(h, len(h) - k)
print(np.sum(h))

### FIXED CODE ###

from math import floor,ceil,sqrt,factorial,log
from collections import Counter, deque
from functools import reduce
import numpy as np
def S(): return input()
def I(): return int(input())
def MS(): return map(str,input().split())
def MI(): return map(int,input().split())
def FLI(): return [int(i) for i in input().split()]
def LS(): return list(MS())
def LI(): return list(MI())
def LLS(): return [list(map(str, l.split() )) for l in input()]
def LLI(): return [list(map(int, l.split() )) for l in input()]
def LLSN(n: int): return [LS() for _ in range(n)]
def LLIN(n: int): return [LI() for _ in range(n)]

n, k = MI()

h = FLI()
h.sort(reverse = True)
print(sum(h[k:]))
fun main(args : Array<String>) {
    val N = readLine()!!.toInt()
    val A = readLine()!!.split(" ").map { it.toInt() }
    val B = (1..N).map {
        val index = it - 1
        A.get(index) - it
    }.sorted()

    val median = B.get(N / 2)

    val answer = B.map { Math.abs(it - median) }.sum()

    print(answer)
}

### FIXED CODE ###

def m():
    n = int(input())
    a = list(map(int, input().split()))
    ans = 0
    B = [a[i-1]-i for i in range(1, n+1)]
    B.sort()
    b = B[n//2]
    for i in range(n):
        ans += abs(B[i]-b)
    return ans

print(m())