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

def main():
    s = list(map(int, list(input())))
    m = [0]*2019
    num = 0
    ans = 0
    n = len(s)
    ten = 1
    for i in range(n):
        num += s[n-i-1]*ten
        num %= 2019
        m[num] += 1 
        ten = (ten*10)
    for mi in m:
        if mi:
            ans += (mi*(mi-1))//2
    ans += m[0]
    print(ans)
        
if __name__ == "__main__":
    main()


### FIXED CODE ###

s = input()

n = len(s)
amari = [0] * 2019
amari[0] += 1
tmp = 0
digit = 1
for i in range(n):
    tmp += int(s[n-i-1]) * digit
    tmp %= 2019
    amari[tmp] += 1
    digit = (digit * 10) % 2019

ans = 0
for i in amari:
    ans += i * (i - 1) // 2

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

s = [int(i) for i in list(input())]
ans = 0

for _ in range(len(s) // 2):
    for i in range(len(s) - 1):
        try:
            if s[i] + s[i + 1] == 1:
                del s[i:i + 2]
                ans += 2
        except IndexError:
            break
print(ans)


### FIXED CODE ###

s = [int(i) for i in list(input())]

print(2 * min(s.count(1), s.count(0)))
### BUGGY CODE ###

S = input()
Q = int(input())

def make_reverse(S):

    if len(S) == 1:
        return S

    reversedS = ""
    for i in range(len(S)-1, -1, -1):
        reversedS += S[i]
    else: return reversedS


def main(S, Q):
    
    for i in range(Q):

        query = input().split()
        if int(query[0]) == 1:
            S = make_reverse(S)
        else:
            if int(query[1]) == 1:
                S = query[2] + S
            else:
                S = S + query[2]
    
    else: return S


if __name__ == "__main__":

    answer = main(S, Q)
    print(answer)
    

### FIXED CODE ###

S = input()
Q = int(input())
lst_query = [input().split() for i in range(Q)]

def make_reverse(S):

    if len(S) == 1:
        return S

    reversedS = ""
    for i in range(len(S)-1, -1, -1):
        reversedS += S[i]
    else: return reversedS

def main(S, Q, lst_query):

    cnt_reverse = 0
    leftS  = ""
    rightS = ""

    for i in range(Q-1, -1, -1):
        
        query = lst_query[i]

        if int(query[0]) == 1:
            cnt_reverse += 1
        else:
            if cnt_reverse % 2 == 0:
                if int(query[1]) == 1: leftS  = leftS + query[2]
                else                 : rightS = query[2] + rightS
            else:
                if int(query[1]) == 1: rightS = query[2] + rightS
                else                 : leftS  = leftS + query[2]

    if cnt_reverse % 2 == 1: S = make_reverse(S)
    return leftS + S + rightS


if __name__ == "__main__":

    answer = main(S, Q, lst_query)
    print(answer)
### BUGGY CODE ###

h,w=map(int,input().split())
s=[input() for i in range(h)]
c=[[[0,0] for i in range(w)] for i in range(h)]
t=0
for H,i in enumerate(s):
    for W,j in enumerate(i):
        if(j=="#"):
            for l in range(1,t+1):
                c[H][W-l][0]=t
            t=0
        else:
            t+=1
    for l in range(1,t+1):
        c[H][-l][0]=t
    t=0    
for W in range(w):
    for H in range(h):
        if(s[H][W]=="#"):
            for l in range(1,t+1):
                c[H-l][W][1]=t
            t=0
        else:
            t+=1
    for l in range(1,t+1):
        c[-l][W][1]=t
    t=0
ans=0
for i in c:
    for j in i:
        ans=max(sum(j),ans)
print(max(ans-1,0))

### FIXED CODE ###

h,w=map(int,input().split())
s=[input() for i in range(h)]
c=[[0 for i in range(w)] for i in range(h)]
t=0
for H in range(h):
    for W in range(w):
        if(s[H][W]=="#"):
            for l in range(1,t+1):
                c[H][W-l]=t
            t=0
        else:
            t+=1
    for l in range(1,t+1):
        c[H][-l]=t
    t=0
ans=0
for W in range(w):
    for H in range(h):
        if(s[H][W]=="#"):
            for l in range(1,t+1):
                ans=max(c[H-l][W]+t,ans)
            t=0
        else:
            t+=1
    for l in range(1,t+1):
        ans=max(c[-l][W]+t,ans)
    t=0
print(max(ans-1,0))
### BUGGY CODE ###

n=int(input())

def f_count(j):
    count=0
    rt=int(j**0.5)+1
    for x in range(1,rt):
        for y in range(1,rt):
            for z in range(1,rt):
                if x**2+y**2+z**2+x*y+y*z+z*x==j:
                    count+=1
    return count
    
for i in range(1,n+1):
    print(f_count(i))
    
                    
            


### FIXED CODE ###

N=int(input())

#f(N)を入れるリスト。f(1)=ans_list[0], f(N)=ans_list[N-1]
ans_list=[0]*N

for x in range(1,100):
    for y in range(1,100):
        for z in range(1,100):
            s=x**2+y**2+z**2+x*y+y*z+z*x
            if s<=N:
                ans_list[s-1]+=1
            
   
for i in range(N):
   print(ans_list[i])
### BUGGY CODE ###

n,k=map(int, input().split()) 
a=list(map(int, input().split()))
mod=10**9+7
dp=[[0]*(k+1) for i in range(n+1)]

for i in range(n+1):
    dp[i][0]=1



for i in range(1,n+1):
    for j in range(1,k+1):
        if j-1-a[i-1]>=0:
            dp[i][j]=dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1-a[i-1]]
            dp[i][j]%mod
        
        else:
            dp[i][j]=dp[i][j-1]+dp[i-1][j]   
            dp[i][j]%mod

print(dp[-1][-1]%mod)
    
    

### FIXED CODE ###

import sys
input = sys.stdin.readline

n,k=map(int, input().split()) 
a=list(map(int, input().split()))
mod=10**9+7
dp=[[0]*(k+1) for i in range(n+1)]

for i in range(n+1):
    dp[i][0]=1



for i in range(1,n+1):
    for j in range(1,k+1):
        if j-1-a[i-1]>=0:
            dp[i][j]=(dp[i][j-1]+dp[i-1][j]-dp[i-1][j-1-a[i-1]])%mod
        
        else:
            dp[i][j]=(dp[i][j-1]+dp[i-1][j])%mod

print(dp[-1][-1]%mod)
### BUGGY CODE ###

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

ans=1
for i in range(a,b+1):
    ans*=i
    
if 0 < ans:
    print('Positive')
elif ans == 0:
    print('Zero')
else:
    print('Negative')

### FIXED CODE ###

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

if 0<a<b:
    print('Positive')

elif a<=0<=b:
    print('Zero')

elif (b-a)%2==0:
    print('Negative')
else:
    print('Positive')
### BUGGY CODE ###

def calc(S):
    N = len(S)
    r = 0
    d = {0: 1}
    for i in range(N):
        r = (r + int(S[N - 1 - i]) * 10 ** i) % 2019
        d[r] = (d[r] if r in d else 0) + 1
    ans = 0
    for c in d:
        ans += d[c] * (d[c] - 1) // 2
    return ans


S = input()
print(calc(S))

### FIXED CODE ###

import sys
def input():
    return sys.stdin.readline().rstrip('\n')

def calc(S):
    N = len(S)
    r = 0
    d = [0] * 2019
    p = 1
    d[0] = 1
    for i in range(N):
        r = (r + int(S[N - 1 - i]) * p) % 2019
        p = (p * 10) % 2019
        d[r] += 1
    ans = 0
    for c in d:
        ans += c * (c - 1) // 2
    return ans


S = input()
print(calc(S))
### BUGGY CODE ###

#!/usr/bin/env python3

from itertools import product

def get_label(labels, target):
    if labels[target] == -1:
        return target
    else:
        temp = get_label(labels, labels[target])
        labels[target] = temp
        return temp


def main():
    n, m = list(map(int, input().split()))
    a = []
    b = []
    for _ in range(m):
        ai, bi = list(map(int, input().split()))
        a.append(ai-1)
        b.append(bi-1)

    # 不便さのMAX
    result = [n * (n-1) // 2]
    labels = [-1] * n
    groups = {}
    for i in range(n):
        groups[i] = {i}


    for j in range(m):
        i = m - 1 - j
        ai = a[i]
        bi = b[i]
        label_a = get_label(labels, ai)
        label_b = get_label(labels, bi)
        if label_a != label_b:
            next_val = result[-1]
            next_val -= len(groups[label_a]) * len(groups[label_b])
            result.append(next_val)
            groups[label_a] |= groups[label_b]
            labels[label_b] = label_a
            del groups[label_b]
        else:
            result.append(result[-1])

    result.reverse()
    for v in result[1:]:
        print(v)

if __name__ == '__main__':
    main()


### FIXED CODE ###

#!/usr/bin/env python3

from itertools import product
import sys
sys.setrecursionlimit(100000)

def get_label(labels, target):
    if labels[target] == -1:
        return target
    else:
        temp = get_label(labels, labels[target])
        labels[target] = temp
        return temp


def main():
    n, m = list(map(int, input().split()))
    a = []
    b = []
    for _ in range(m):
        ai, bi = list(map(int, input().split()))
        a.append(ai-1)
        b.append(bi-1)

    # 不便さのMAX
    result = [n * (n-1) // 2]
    labels = [-1] * n
    groups = {}
    for i in range(n):
        groups[i] = 1

    for j in range(m):
        i = m - 1 - j
        ai = a[i]
        bi = b[i]
        label_a = get_label(labels, ai)
        label_b = get_label(labels, bi)
        if label_a != label_b:
            next_val = result[-1]
            next_val -= groups[label_a] * groups[label_b]
            result.append(next_val)
            groups[label_a] += groups[label_b]
            labels[label_b] = label_a
            del groups[label_b]
        else:
            result.append(result[-1])

    result.reverse()
    for v in result[1:]:
        print(v)

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

n = int(input())
s = [int(x) for x in input().split()]
q = int(input())
t = [int(x) for x in input().split()]
cnt = 0
y = None
for x in s:
    if x == y:
        continue
    else:
        if x in t:
            cnt += 1
            y = x
        else:
            continue
print(cnt)


### FIXED CODE ###

def binarySearch(array, key):
    left = 0
    right = len(array)
    while left < right:
        mid = int((left + right) / 2)
        if key == array[mid]:
            return True
        elif key > array[mid]:
            left = mid + 1
        elif key < array[mid]:
            right = mid
        else:
            print("ERROR")
    return False


n = int(input())
s = [int(x) for x in input().split()]
q = int(input())
t = [int(x) for x in input().split()]
a = [x for x in t if binarySearch(s, x)]
print(len(a))
### BUGGY CODE ###

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

si = [[0]for i in range(n+1)]
a = []


import bisect

for i in range(m):
    p,y = map(int,input().split())
    a.append([p,y])
    bisect.insort_left(si[p],y)




for i in range(m):
    ans = bisect.bisect_right(si[a[i][0]],a[i][1]) - 1
    print('0'*(6-len(str(a[i][0]))) + str(a[i][0]) + '0'*(6-len(str(ans))) + str(ans))
    

    


### FIXED CODE ###

import sys
input = sys.stdin.readline
n,m = map(int,input().split())
py = [list(map(int,input().split()))for i in range(m)]
pypy = py[::]
from operator import itemgetter
import bisect
py.sort(key = itemgetter(1))
dic = {}
for i in range(m):
    if py[i][0] not in dic:
        dic[py[i][0]] = []
    dic[py[i][0]].append(py[i][1])


anslist = [0]*m

for i in range(m):
    anslist[i] = str(pypy[i][0]).zfill(6) + str(bisect.bisect_left(dic[pypy[i][0]],pypy[i][1]) + 1).zfill(6)

for ans in anslist:
    print(ans)
### BUGGY CODE ###

import numpy as np
N, D, A = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort(key=lambda x: x[0])
XH = np.array(XH).astype(np.int64)

X = XH[:, 0]
H = XH[:, 1]

ans = 0

for i in range(N):
    if H[i] <= 0:
        continue
    pos = X[i]
    explode = (H[i] + A - 1) // A
    ex_range = (X >= pos) & (X <= pos+2*D)
    H[ex_range] -= explode*A

    ans += explode

print(ans)


### FIXED CODE ###

from collections import deque
N, D, A = map(int, input().split())
XH = [list(map(int, input().split())) for _ in range(N)]
XH.sort()

que = deque([])
ans = 0
total = 0

for i in range(N):
    x, h = XH[i]
    if h <= 0:
        continue
    while que and XH[i][0] > que[0][0]:
        _, tmp = que.popleft()
        total -= tmp

    h -= total
    if h > 0:
        atk = (h + A - 1) // A
        damage = atk * A
        ans += atk
        total += damage
        que.append((x+2*D, damage))

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

import bisect
n,m = [int(i) for i in input().split()]
l = sorted([int(i) for i in input().split()])
[bisect.insort(l,l[n-1]//2) for _ in range(m)]
    
print(sum(l[0:n]))

### FIXED CODE ###

import heapq
n,m = [int(i) for i in input().split()]
l = [int(i) for i in input().split()]
h = []
for i in l:
    i = -1*i
    heapq.heappush(h,i)
    
for _ in range(m):
    v = -heapq.heappop(h)
    heapq.heappush(h,-1*(v//2))
    
print(-sum(h))
### BUGGY CODE ###

X, Y, Z, K = map(int, input().split())
A = list(map(int, input().split()))
B = list(map(int, input().split()))
C = list(map(int, input().split()))

A.sort(reverse=True)
B.sort(reverse=True)
C.sort(reverse=True)

result = []
for i in range(len(A)):
    for j in range(len(B)):
        for k in range(len(C)):
            if (i*j*k) <= K:
                result.append(A[i]+B[j]+C[k])
            else:
                break

result.sort(reverse=True)

for i in range(K):
    print(result[i])


### FIXED CODE ###

x,y,z,k=map(int,input().split())
a=list(map(int,input().split()))
b=list(map(int,input().split()))
c=list(map(int,input().split()))
e=[]
for ai in a:
    for bi in b:
        e.append(ai+bi)
e.sort(reverse=True)
e=e[:k]
ans=[]
for ci in c:
    for ei in e:
        ans.append(ci+ei)
ans.sort(reverse=True)
for i in range(k):
    print(ans[i])
### BUGGY CODE ###

import itertools
N = int(input())
l = [int(i) for i in input().split()]
count = 0
for v in itertools.combinations(l,3):
    if max(v[0],v[1],v[2])*2 < sum(v):
        count += 1
print(count)

### FIXED CODE ###

import bisect
N = int(input())
l = [int(i) for i in input().split()]
count = 0
l_new = sorted(l)
for i,a in enumerate(l_new):
    for j,b in enumerate(l_new[i+1:],start = i+1):
        left = bisect.bisect_right(l_new,abs(a-b))
        right = bisect.bisect_left(l_new,a + b)
        count += right - left
        
        if left <= i < right:
            count -= 1
        if left <= j < right:
            count -= 1
        
print(count//3)
### BUGGY CODE ###

# coding: utf-8
# Your code here!
from sys import stdin
#import math
#from functools import reduce
    
N, M = [int(x) for x in stdin.readline().rstrip().split()]
#N = int(input())
#S = list(input())

costs = []

#is_exist = 'Yes'
for n in range(N):
    ai, bi = [int(x) for x in stdin.readline().rstrip().split()]
    costs += [ai]*bi
    
costs.sort()
#print(costs)

print(sum(costs[:M]))

### FIXED CODE ###

# coding: utf-8
# Your code here!
from sys import stdin
import numpy as np
#import math
#from functools import reduce
    
N, M = [int(x) for x in stdin.readline().rstrip().split()]
#N = int(input())
#S = list(input())

costs = []
num = []

for n in range(N):
    ai, bi = [int(x) for x in stdin.readline().rstrip().split()]
    costs += [ai]
    num += [bi]
    
sorted_idx = np.argsort(costs)
costs = list(np.array(costs)[sorted_idx])
num = list(np.array(num)[sorted_idx])

count_num = 0
count_cost = 0
for i, n in enumerate(num):
    if count_num + n < M:
        count_cost += n*costs[i]
        count_num += n
    else:
        count_cost += costs[i]*(M-count_num)
        break

print(count_cost)
### BUGGY CODE ###

import sys
from heapq import *

H,W=map(int,input().split())
si,sj=[int(x)-1 for x in input().split()]
ti,tj=[int(x)-1 for x in input().split()]
A=list(sys.stdin)

ans=-1
hp=[(0,si,sj)]
dirs=[-2,-1,0,1,2]
dist=[[float('inf')]*W for _ in range(H)]
dist[si][sj]=0
while hp:
    k,i,j=heappop(hp)
    if i==ti and j==tj:
        ans=k
        break
    for di in dirs:
        for dj in dirs:
            if di==dj==0:
                continue
            ni,nj=i+di,j+dj
            if not (0<=ni<H and 0<=nj<W):
                continue
            if A[ni][nj]=='#':
                continue
            if abs(di)+abs(dj)==1:
                nk=k
            else:
                nk=k+1
            if nk>=dist[ni][nj]:
                continue
            dist[ni][nj]=nk
            heappush(hp,(nk,ni,nj))

print(ans)


### FIXED CODE ###

import sys
from heapq import *

H,W=map(int,input().split())
si,sj=[int(x)-1 for x in input().split()]
ti,tj=[int(x)-1 for x in input().split()]
A=list(sys.stdin)

ans=-1
hp=[(0,si,sj)]
dirs=[-2,-1,0,1,2]
dist=[[float('inf')]*W for _ in range(H)]
dist[si][sj]=0
while hp:
    k,i,j=heappop(hp)
    if i==ti and j==tj:
        ans=k
        break
    if k>dist[i][j]:
        continue
    for di in dirs:
        for dj in dirs:
            if di==dj==0:
                continue
            ni,nj=i+di,j+dj
            if not (0<=ni<H and 0<=nj<W):
                continue
            if A[ni][nj]=='#':
                continue
            if abs(di)+abs(dj)==1:
                nk=k
            else:
                nk=k+1
            if nk>=dist[ni][nj]:
                continue
            dist[ni][nj]=nk
            heappush(hp,(nk,ni,nj))

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

n,m=map(int,input().split())
a=list(map(int,input().split()))
a.sort()
d=[]
for i in range(m):
  b,c = map(int,input().split()) 
  d.extend([c]*b)
if n < len(d):
  d=d[:n]
d.sort()
d=d[::-1]
for i in range(len(d)):
  for j in range(n):
    if a[j] < d[i]:
      a[j]=d[i]
      break
print(sum(a))

### FIXED CODE ###

n,m=map(int,input().split())
a=list(map(int,input().split()))
bc=[list(map(int,input().split())) for i in range(m)]
bc.sort(key=lambda x:x[1])
for b,c in bc[::-1]:
  a.extend([c]*b)
  if len(a)>2*n:
    break
a.sort(reverse=True)
print(sum(a[:n]))
### BUGGY CODE ###

N=int(input())
A=input().split()

a=True
for i in range(N):
    b=A[0]
    A.remove(b)
    if (b in A)==True:
        print("NO")
        a=False
        break
if a==True:
    print("YES")

### FIXED CODE ###

N=int(input())
A=input().split()

B=set(A)
if len(A)==len(B):
    print("YES")
else:
    print("NO")
### BUGGY CODE ###

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

ans = []
for i in range(N):
  if i%2 == (N-1)%2:
    ans = [A[i]] + ans
  else:
    ans = ans + [A[i]]
print(*ans)

### FIXED CODE ###

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

print(*([A[i] for i in range(N-1,-1,-2)]+[A[i] for i in range(N%2,N,2)]))
### BUGGY CODE ###

s = input()
l = len(s)
#後ろから見たら一意
import sys
i = l-1
try:
    while i>0:
        if s[i]=="r":
            if s[i-5:i+1]=="eraser":
                i-=6
            elif s[i-6:i+1]=="dremer":
                i-=7
        else:
            if s[i-4:i+1]=="erase":
                i-=5
            elif s[i-4:i+1]=="dream":
                i -= 5
            else:
                print("NO")
                sys.exit()
    print("YES")
except:
    print("NO")


### FIXED CODE ###

s = input()
l = len(s)
#後ろから見たら一意
"""
tryブロックでsys.exit()を呼ぶと強制終了しない。
"""
import sys
i = l-1
try:
    while i>-1:
        if s[i]=="r":
            if s[i-5:i+1]=="eraser":
                i-=6
            elif s[i-6:i+1]=="dreamer":
                i-=7
            else:
                print("NO")###
                sys.exit()
        else:
            if s[i-4:i+1]=="erase":
                i-=5
            elif s[i-4:i+1]=="dream":
                i -= 5
            else:
                print("NO")###
                sys.exit()
    print("YES")
except:
    pass
### BUGGY CODE ###

import math

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

def Combi(n,r):
    return math.factorial(n) // (math.factorial(n - r) * math.factorial(r))


ANS=0

if B>A:
    (A,B)=(B,A)

ran=K//A

for i in range(min(ran,N)+1):
    if (K-(A*i))%B==0:
        if (K-(A*i))//B<=N:
            ANS = (ANS+(Combi(N,i)*Combi(N,(K-(A*i))//B)))%998244353

print(ANS)


### FIXED CODE ###

N,A,B,K=map(int,input().split())
mod=998244353

INV=[None]*(N+1)
for i in range(1,N+1):
    INV[i]=pow(i,mod-2,mod)

Combi=[None]*(N+1)
Combi[0]=1
Combi[1]=N
for i in range(2,N//2+2):
    Combi[i]=Combi[i-1]*(N-i+1)*INV[i] %mod
for i in range(N//2+2,N+1):
    Combi[i]=Combi[N-i]


ANS=0

if B>A:
    (A,B)=(B,A)

ran=K//A

for i in range(min(ran,N)+1):
    q, r = divmod(K-(A*i), B)
    if r==0 and q<=N:
        ANS = (ANS+(Combi[i]*Combi[q])%mod)%mod

print(ANS)
### BUGGY CODE ###

n = input()
R = [input()] 
Rmin = 0
maxdif = -999999999
for i in xrange(n-1):
    Rt = input()
    for j in xrange(Rmin, len(R)):
        if (Rt - R[j]) > maxdif:
            maxdif = Rt - R[j]
    if Rt < Rmin:
        Rmin = i + 1
    R.append(Rt)

print maxdif

### FIXED CODE ###

n = input()
R = [input() for i in xrange(n)]

Rmin = n
maxdif = R[1] - R[0]

while Rmin > 0:
    tRmin = R.index(min(R[0:Rmin]))
    Rmax = R.index(max(R[tRmin:Rmin]))
    if tRmin == Rmax:
        if tRmin == n-1:
            tRmin-=1
        elif tRmin < n-1:
            Rmax = tRmin + 1
    Rmin = tRmin
    if (R[Rmax] - R[Rmin]) > maxdif:
        maxdif = R[Rmax] - R[Rmin]

print maxdif
### BUGGY CODE ###

N = int(input())
res = 200
tmp = N
for i in range(1, N+1):
    if N%i == 0:
        if max(len(str(i)),len(str(int(N/i)))) < res:
            res = max(len(str(i)),len(str(int(N/i))))
    
    if tmp < N/i:
            break
    tmp = N/i
print(res)

### FIXED CODE ###

N = int(input())

def prime_factor(n):
    i = 2
    table = []
    while i * i <= n:
        while n % i == 0:
            n //= i
            table.append(i)
        i += 1
    if n > 1:
        table.append(n)
    return table

res = prime_factor(N)

result = 10 ** 10
for i in range(1, N+1):
    if N%i == 0:
        result = min(result, max(len(str(i)), len(str(N//i))))
    if i*i > N:
        break


print(result)
### BUGGY CODE ###

from bisect import bisect_left

N = int(input())
As = [int(input()) for _ in range(N)]

list_ = [As[0]]
for a in As[1:]:
    i = bisect_left(list_, a) - 1
    if i < 0:
        list_.insert(0, a)
    else:
        list_[i] = a
print(len(list_))

### FIXED CODE ###

from bisect import bisect_left
from collections import deque

N = int(input())
As = [int(input()) for _ in range(N)]

list_ = deque([As[0]])
for a in As[1:]:
    i = bisect_left(list_, a) - 1
    if i < 0:
        list_.appendleft(a)
    else:
        list_[i] = a
print(len(list_))
### BUGGY CODE ###

N = int(input())

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

for i in range(1, N+1):
    print(A.index(i)+1, end=" ")
print()


### FIXED CODE ###

N = int(input())

A = list(map(int, input().split()))
ans = [0]*N
for i in range(N):
    ans[A[i]-1] = i+1

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

n = int(input())
lis = sorted(list(map(int,input().split())))
now = -1
ans = 0
for x in range(n):
    if lis[x] == now:
        continue
    now = lis[x]
    val = 0
    for y in range(n-x):
        if lis[x]+2 >= lis[x+y]:
            val += 1
            ans = max(ans,val)

print(ans)


### FIXED CODE ###

n = int(input())
lis = sorted(list(map(int,input().split())))
now = -1
ans = 0
for x in range(n):
    if lis[x] == now:
        continue
    now = lis[x]
    val = 0
    for y in range(n-x):
        if lis[x]+2 >= lis[x+y]:
            val += 1
            ans = max(ans,val)
        else:
            break

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

import numpy as np

def f7(seq):
    seen = set()
    seen_add = seen.add
    return [ x for x in seq if x not in seen and not seen_add(x)]

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

a_list = np.zeros(100005)

for a in A_uniq:
    a_cnt = A.count(a)
    a_list[a] += a_cnt
    a_list[a+1] += a_cnt
    a_list[a+2] += a_cnt
    
print(int(a_list.max())) 

### FIXED CODE ###

import numpy as np
from collections import Counter

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

ans = 0
counter = Counter(A)
for a, cnt in counter.most_common():
    tmp = counter[a-1] + cnt + counter[a+1]
    if ans < tmp:
        ans = tmp
        

print(ans)