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

N=int(input())
S=[input() for i in range(N)]
r=0
for k in range(N):
    f=1
    for i in range(len(S)-1):
        for j in range(i+1,len(S)):
            if S[i-k][j]!=S[j-k][i]:
                f=0
                break
        if f==0:
            break
    if f:
        r+=N
print(r)

### FIXED CODE ###

N=int(input())
S=[input() for i in range(N)]
St=list(map(''.join,zip(*S)))
r=0
for k in range(N):
    f=1
    for i in range(N):
        if S[i][k:]+S[i][:k]!=St[i+k-N]:
            f=0
            break
    if f:
        r+=N
print(r)
### BUGGY CODE ###

import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    H,N=mis()
    AB = tuple(tuple(mis()) for _ in range(N))
    d = defaultdict(int)
    for h in range(H):
        for i in range(N):
            p_use = d[(h-AB[i][0], i)]+AB[i][1] if h-AB[i][0] >= 0 else AB[i][1]
            p_not = d[(h,i-1)] if i>0 else INF
            d[(h,i)] = min(p_use,p_not)
    print(d[(H-1, N-1)])

main()


### FIXED CODE ###

import sys
sys.setrecursionlimit(1000000000)
import math
from fractions import gcd
from itertools import count, permutations
from functools import lru_cache
from collections import deque, defaultdict
from pprint import pprint
ii = lambda: int(input())
mis = lambda: map(int, input().split())
lmis = lambda: list(mis())
INF = float('inf')
N1097 = 10**9 + 7

def meg(f, ok, ng):
    while abs(ok-ng)>1:
        mid = (ok+ng)//2
        if f(mid):
            ok=mid
        else:
            ng=mid
    return ok
#

def main():
    H,N=mis()
    AB = tuple(tuple(mis()) for _ in range(N))
    DP = [INF] * (H+1)
    DP[0] = 0
    for h in range(1, H+1):
        for i in range(N):
            DP[h] = min(DP[h], (DP[h-AB[i][0]]+AB[i][1] if h-AB[i][0]>0 else AB[i][1]))

    print(DP[-1])

main()
### BUGGY CODE ###

import itertools
import math


def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    B = itertools.combinations(A, 2)
    new_arr = []
    for b in B:
        c = math.gcd(b[0], b[1])
        if c != 1:
            new_arr.append(c)

    if len(new_arr) == 0:
        print("pairwise coprime")
    elif len(list(set(new_arr))) != 1:
        print("setwise coprime")
    else:
        print("not coprime")

resolve()

### FIXED CODE ###

import math


def resolve():
    n = int(input())
    A = list(map(int, input().split()))
    M = max(A) + 1
    C = [0 for i in range(M)]
    for a in A:
        C[a] += 1

    pairwise = True
    for i in range(2, M):
        cnt = 0
        for j in range(i, M, i):
            cnt += C[j]

        if cnt > 1:
            pairwise = False

    if pairwise:
        print("pairwise coprime")
        return

    g = 0
    for i in range(n):
        g = math.gcd(g, A[i])

    if g == 1:
        print("setwise coprime")
        return

    print("not coprime")

resolve()
### BUGGY CODE ###

n = int(input())
b = [int(x) for x in input().split()]
r = 1
max = 10**18

for i in b:
  r *= i
  
r = -1 if r > max else r
print(r)


### FIXED CODE ###

n = int(input())
l = [int(x) for x in input().split()]

if 0 in l:
    r=0
else:
    r = 1
    for x in range(n):
        r = r * l[x]
        if r > 10**18:
            r=-1
            break
  
print(r)
### BUGGY CODE ###

A = input()
ans = 1
for i in range(len(A)):
  for j in range(i,len(A)):
    if A[i] != A[j]:
      ans += 1
      
print(ans)


### FIXED CODE ###

A = input()

Alphabet = list("abcdefghijklmnopqrstuvwxyz")

N = len(A)
ans = N*(N-1)/2 + 1

for i in Alphabet:
  z = 0
  for j in range(len(A)):
    if i == A[j]:
      z+=1
  if z>1:
    ans -= z*(z-1)/2
    
print(int(ans))
### BUGGY CODE ###

s = input()
K = int(input())

sub = []
for i in range(1, len(s)+1):
    for k in range(len(s)-i+1):
        sub.append(s[k:k+i])

sub = list(set(sub))
sub.sort()
print(sub[K-1])


### FIXED CODE ###

s = input()
K = int(input())

sub = []
for i in range(1, K+1):
    for k in range(len(s)-i+1):
        sub.append(s[k:k+i])

sub = list(set(sub))
sub.sort()
print(sub[K-1])
### BUGGY CODE ###


n = int(input())

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

#mid = n//2 + n%2

ans = [0]*n
for i, a in enumerate(an[::-1]):

    ta = [x for ii,x in enumerate(an[i:]) if i % (n-(ii+i)) == 0]
    t = sum(ta)
#    print(ta,t,i,a)
    ans[-i] = t%2

m = sum(ans)
print(m)

if m > 0:
    print(*[x for x in ans if x >0])

### FIXED CODE ###


n = int(input())

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

#mid = n//2 + n%2

#print(* range(10)[::2] )

ans = [0]*(n+1)

for _ in range(n):# 0 ... n-1
    i = n-_ # n ... 1

    ta = sum(ans[i::i])
    ans[i] = 0 if ta%2 == an[i-1] else 1

#    print(i, an[i-1::i])


m = sum(ans)
print(m)

if m > 0:
    print(*[i for i, x in enumerate(ans) if x >0])
### BUGGY CODE ###

w,h= map(int, raw_input().split())
p =[]
q = []
for i in xrange(w):
    t = input()
    p.append(t)

for i in xrange(h):
    t = input()
    q.append(t)
p =sorted(p,reverse=True)
q =sorted(q, reverse=True)
ac = p[:]
i = w-2
while i >=0:
    ac[i] += ac[i+1]
    i -=1
c = ac[0] + sum(q)
for i in xrange(h):
    for j in xrange(w):
        if q[i] > p[j]:
            c += ac[j]
            break
        c += q[i]
print c

### FIXED CODE ###

w,h= map(int, raw_input().split())
p =[]
q = []
for i in xrange(w):
    t = input()
    p.append(t)

for i in xrange(h):
    t = input()
    q.append(t)
p =sorted(p,reverse=True)
q =sorted(q, reverse=True)
ac = p[:]
acq = q[:]
i = w-2
while i >=0:
    ac[i] += ac[i+1]
    i -=1
i = h - 2
while i >= 0:
    acq[i] += acq[i + 1]
    i -= 1
c = ac[0] + acq[0]
k = 0
# for i in xrange(h):
i = 0
while i < h:
    # for j in xrange(k,w):
        j = k
        # print i,j
        if j >= w:
            break
        if q[i] > p[j]:
            c += ac[j]
            i += 1
            # break
        else:
            c +=acq[i]
            k +=1
        # c += q[i]
print c
### BUGGY CODE ###

N=int(input())
A=list(map(int,input().split()))
p=[None]*N
for i,a in enumerate(A):
    p[a-1]=i
ans=0
b=[-1,N]
from bisect import bisect
for i in range(N):
    s=bisect(b,p[i])
    ans+=(i+1)*(p[i]-b[s-1])*(b[s]-p[i])
    b=b[:s]+[p[i]]+b[s:]
print(ans)

### FIXED CODE ###

N=int(input())
A=list(map(int,input().split()))
p=[None]*N
for i,a in enumerate(A):
    p[a-1]=i
ans=0
l,r=[i for i in range(N)],[i for i in range(N)]
for i in range(N-1,-1,-1):
    left,right=l[p[i]],r[p[i]]
    ans+=(i+1)*(p[i]-left+1)*(right-p[i]+1)
    if left>0:
        r[left-1]=right
    if right<N-1:
        l[right+1]=left
print(ans)
### BUGGY CODE ###

def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista 

def NWD(A, B):
    if A < B:
        A, B = B, A 
    if B == 0: 
        return A
    return NWD(A%B, B)

    
def NWW(A,B):
    return A*B//NWD(A,B)
    
def flatten():
    N = wczytaj_liste()[0]
    A = wczytaj_liste()
    B = []
    najwieksza_wielokrotnosc = A[0]
    for i in range(N): 
        najwieksza_wielokrotnosc = NWW(najwieksza_wielokrotnosc, A[i])
    for i in range(N):
        B.append(najwieksza_wielokrotnosc//A[i])
    print(sum(B)%(10**9+7))

flatten()

### FIXED CODE ###

def wczytaj_liste(): 
    wczytana_lista = input()
    lista_znakow = wczytana_lista.split()
    ostateczna_lista = []
    for element in lista_znakow:
        ostateczna_lista.append(int(element))
    return ostateczna_lista 


def flatten():
    MOD = 10**9+7
    N = wczytaj_liste()[0]
    A = wczytaj_liste()
    najwieksza = max(A)
    najmniejszy_dzielnik = [None] * (najwieksza + 1)
    for i in reversed(range(2, najwieksza + 1)):
        for j in range(0, najwieksza + 1, i):
            najmniejszy_dzielnik[j] = i
    najwieksze_wykladniki = [0] * (najwieksza + 1)
    for liczba in A:
        dzielnik = 1
        wykladnik = 0
        while liczba != 1:
            d = najmniejszy_dzielnik[liczba]
            if d == dzielnik:
                wykladnik += 1
            else:
                if najwieksze_wykladniki[dzielnik] < wykladnik:
                    najwieksze_wykladniki[dzielnik] = wykladnik
                dzielnik = d
                wykladnik = 1
                
            liczba //= d
            
        if najwieksze_wykladniki[dzielnik] < wykladnik:
            najwieksze_wykladniki[dzielnik] = wykladnik
    
    nww = 1
    for dzielnik, wykladnik in enumerate(najwieksze_wykladniki):
        nww = nww * pow(dzielnik, wykladnik, MOD) % MOD
    
    suma = 0
    for liczba in A:
        suma += nww * pow(liczba, MOD - 2, MOD)
        suma %= MOD
    print(suma)
        

flatten()
### BUGGY CODE ###

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

def kouyaku(n,p):
    for i in range(round((p**(1/n)+1)),0,-1):        
        if p%(i**n)==0:
                return i
            
print(kouyaku(n,p))

### FIXED CODE ###

N, P = map(int, input().split())
ans = 1
 
if N >= 45:
  print(ans)
elif N == 1:
  print(P)
  
 
  
else:
  i = 1
  while(i**N <= P):
    if P % (i**N) == 0:
      ans = i
    i += 1
  print(ans)
### BUGGY CODE ###

N,W = map(int,input().split())
w = []
v = []
for i in range(N):
    x,y = map(int,input().split())
    w.append(x)
    v.append(y)

dp = [[0]*(W+1) for j in range(N+1)]

for i in range(N-1,-1,-1):# 2 1 0
    for j in range(W+1):# 0 1 2 3 4 5 6 7 8
        if j < w[i]:
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j],dp[i+1][j-w[i]]+v[i])

print(dp[0][W])

### FIXED CODE ###

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

dp = [[0]*(W+1) for j in range(n+1)]

for i in range(n-1,-1,-1):
    for j in range(W+1):
        if j < w[i]:
            dp[i][j] = dp[i+1][j]
        else:
            dp[i][j] = max(dp[i+1][j],dp[i+1][j-w[i]]+v[i])
print(dp[0][W])
### BUGGY CODE ###

n,w=map(int,input().split())
wv=[list(map(int,input().split())) for _ in range(n)]
#wv.sort()
dp=[[0]*(w+1) for _ in range(n)]
for i in range(1,w+1):
    if i<wv[0][0]:
        dp[0][i]=0
    else:
        dp[0][i]=wv[0][1]
for i in range(1,n):
    for j in range(1,w+1):
        if wv[i][0]>j:
            dp[i][j]=dp[i-1][j]
        else:
            wleft=j-wv[i][0]
            dp[i][j]=max(wv[i][1]+dp[i-1][wleft],dp[i-1][j])
print(dp[-1][-1])

### FIXED CODE ###

n,w=map(int,input().split())
wv=[list(map(int,input().split())) for _ in range(n)]
#wv.sort()
dp=[[0]*(w+1) for _ in range(n)]
for i in range(1,w+1):
    if i<wv[0][0]:
        dp[0][i]=0
    else:
        dp[0][i]=wv[0][1]
for i in range(1,n):
    for j in range(1,w+1):
        if wv[i][0]>j:
            dp[i][j]=dp[i-1][j]
        else:
            wleft=j-wv[i][0]
            dp[i][j]=max(wv[i][1]+dp[i-1][wleft],dp[i-1][j])
print(dp[-1][-1])
### BUGGY CODE ###

H,W,D = map(int,input().split())
A = [[] for _ in range(H)]
posi = [[]] * (H * W)

for _ in range(H):
  a = list(map(int,input().split()))
  A[_] = a
  for i,j in enumerate(a):
    k = i + 1
    t = _ + 1
    posi[j - 1] = [t,k]

Q = int(input())

dist = [0] * (H * W)
acdist = [0] * (H * W)

for _ in range(0,H * W - D):
  for d in range(_,H * W - D,D):
    acdist[_] += abs(posi[d + D][0] - posi[d][0]) + abs(posi[d + D][1] - posi[d][1])

for i in range(Q):
  l,r = map(int,input().split())
  print(acdist[l - 1] - acdist[r - 1])

### FIXED CODE ###

H,W,D = map(int,input().split())
posi = [[]] * (H * W)

for _ in range(H):
  a = list(map(int,input().split()))
  for i,j in enumerate(a):
    posi[j - 1] = [_ + 1,i + 1]

Q = int(input())

acdist = [0] * (H * W)

for _ in range(0,H * W - D):
  acdist[_ + D] += acdist[_] + abs(posi[_ + D][0] - posi[_][0]) + abs(posi[_ + D][1] - posi[_][1])

for i in range(Q):
  l,r = map(int,input().split())
  print(acdist[r - 1] - acdist[l - 1])
### BUGGY CODE ###

from collections import deque
n=int(input())
a=[deque(list(map(int,input().split()))) for _ in range(n)] 
tcnt,ans=0,0
while tcnt<n*(n-1)//2:
    cnt=0
    chk=[]
    for i in range(n-1):
        if i in chk:
            continue
        else:
            if a[i]:
                b=a[i][0]-1
                if b in chk:
                    continue
                else:
                    if b>i and a[b][0]-1==i:
                        chk.append(a[i].popleft()-1)
                        a[b].popleft()
                        cnt+=1
    tcnt+=cnt
    ans+=1
    if cnt==0:
        ans=-1
        break
print(ans)

### FIXED CODE ###

from collections import deque
n=int(input())
x=lambda i:int(i)-1
a=[deque(list(map(x,input().split()))+[-1]) for _ in range(n)] 
tcnt,ans=n*(n-1),0
chk=set(range(n))
while tcnt>0:
    chk_next=set()
    for i in chk:
        if a[a[i][0]][0]==i:
            chk_next.add(i)
    if len(chk_next)==0:
        ans=-1
        break
    tcnt-=len(chk_next)
    chk=set()
    for i in chk_next:
        a[i].popleft()
        chk.add(i)
        if a[i][0]!=-1:
            chk.add(a[i][0])
    ans+=1

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

m = input()
S = [[1]*m for i in range(m)]
for i in range(input()):
	x,y = map(int,raw_input().split())
	S[y-1][x-1] = 0
	for j in range(m):
		if S[x-1][j] == 0: S[y-1][j] = 0
		if S[j][y-1] == 0: S[j][x-1] = 0
R = [sum(S[i]) for i in range(m)]
C = [sum([S[j][i] for j in range(m)]) for i in range(m)]
while sum(R) + sum(C) > m*(m+1):
	for r in range(m):
		for c in range(m):
			if r != c and S[r][c] == 1 and  R[r] + C[r] > m+1 and R[c] + C[c] > m+1:
				S[r][c] = 0
				R[r] -= 1
				C[c] -= 1
rank = sorted([[C[i],i+1] for i in range(m)])
for r,i in rank: print i

### FIXED CODE ###

def solve(a):
	for i in M-set(a):
		if any(x == i and y not in a for x,y in xy): continue
		r = solve([i]+a)
		if r: return r
	return a
m = input()
M = set(range(1,m+1))
xy = [map(int,raw_input().split()) for i in range(input())]
for i in solve([]): print i
### BUGGY CODE ###

x = int(input())

ans = 0
for i in range(1, x + 1):
    L = [i for i in range(1, i + 1)]
    if sum(L) >= x:
        ans = i
        break
print(ans)

### FIXED CODE ###

x = int(input())

ans, pos = 0, 0
for i in range(1, x + 1):
    pos += i
    if pos >= x:
        ans = i
        break
print(ans)
### BUGGY CODE ###

n = input()

INFTY = 10000000

color = [0 for i in xrange(n)]
M = [[0 for i in xrange(n)] for i in xrange(n)]
d = [INFTY for i in xrange(n)]
p = [-1 for i in xrange(n)]

def MST():
  d[0] = 0

  while True:
    cost = INFTY
    for i in xrange(n):
      if color[i] != 1 and d[i] < cost:
        cost = d[i]
        u = i

    if cost == INFTY:
      break
    color[u] = 2

    for v in xrange(n):
      if color[v] != 2 and M[u][v] != INFTY:
        if M[u][v] < d[v]:
          d[v] = M[u][v]
          p[v] = u
          color[v] = 1

  sum = 0
  for i in xrange(n):
    if p[i] != -1:
      sum += M[i][p[i]] 
  return sum

for i in xrange(n):
  G = map(int, raw_input().split())
  for j in range(n):
   if G[j] == -1:
     M[i][j] = INFTY
   else:
     M[i][j] = G[i]

print MST()

### FIXED CODE ###

n = input()

INFTY = 10000000

color = [0 for i in xrange(n)]
M = [[INFTY for i in xrange(n)] for i in xrange(n)]
d = [INFTY for i in xrange(n)]
p = [-1 for i in xrange(n)]

def MST():
  d[0] = 0

  while True:
    cost = INFTY
    for i in xrange(n):
      if color[i] != 2 and d[i] < cost:
        cost = d[i]
        u = i

    if cost == INFTY:
      break
    
    color[u] = 2

    for v in xrange(n):
      if color[v] != 2 and M[u][v] != INFTY and M[u][v] < d[v]:
        d[v] = M[u][v]
        p[v] = u
        color[v] = 1

  sum = 0
  for i in xrange(n):
    if p[i] != -1:
      sum += M[i][p[i]]
  return sum

for i in xrange(n):
  G = map(int, raw_input().split())
  for j in range(n):
   if G[j] != -1:
     M[i][j] = G[j]

print MST()
### BUGGY CODE ###

import collections
n = int(input())
a = [int(i) for i in input().split()]
cola = collections.Counter(a)
mult = [1] * (10**6+1)

for s in set(a):
  tmp = s * 2
  while tmp <= 10 ** 6:
    mult[tmp] = 0
    tmp += s
  
ans = 0
for s in set(a):
  if cola[s] == 1 and mult[s] == 1:
    ans += 1
    
print(ans)


### FIXED CODE ###

from collections import Counter
n = int(input())
a = list(map(int, input().split()))
c = Counter(a)
m = [True] * (10**6+1)
s = list(set(a))
for u in s:
    t = u * 2
    while t <= 10 ** 6:
        m[t] = False
        t += u
r = 0
for u in s:
    if c[u] == 1 and m[u] == True:
        r += 1
print(r)
### BUGGY CODE ###

n = int(input())
a = list(map(int,input().split()))
ans = 0
m = 10**9 + 7
for i in range(len(a)):
    ans += a[i] * sum(a[i+1:])
print(ans % m)

### FIXED CODE ###

n = int(input())
a = list(map(int, input().split()))
c = 10 ** 9 + 7
ans = 0
s = 0
for i in range(n-1, -1, -1):
    ans += s * a[i]
    s += a[i]
print(ans % c)
### BUGGY CODE ###

import math
n=int(input())
nn=int(math.sqrt(n))
for i in range(1,n+1):
    count=0
    for x in range(1,nn+1):
        for y in range(1,nn+1):
            for z in range(1,nn+1):
                #print(x*x+y*y+z*z+x*y+y*z+z*x)
                if (x*x+y*y+z*z+x*y+y*z+z*x)==i:
                    count=count+1
    print(count)


### FIXED CODE ###

import math
n=int(input())
for i in range(1,n+1):
    nn=int(math.sqrt(i))
    min=int((nn+1)/math.sqrt(3))
    min1=int((nn+1)/math.sqrt(2))
    count=0
    for x in range(1,min+1):
        for y in range(x,min1+1):
            for z in range(y,nn+1):
                #print(x*x+y*y+z*z+x*y+y*z+z*x)
                if (x*x+y*y+z*z+x*y+y*z+z*x)==i:
                    if x==y and y==z and z==x:
                        count=count+1
                    elif x!=y and y!=z and z!=x:
                        count=count+6
                    else:
                        count=count+3
    print(count)
### BUGGY CODE ###

import collections
S = list(reversed(input()))
size = len(S)
ans = 0
d = [-1]*(size)#余りを格納

def cnt(num):
  c = collections.Counter(d)
  return c[num]
  
for i in range(size):
  s = ''.join(reversed(S[:i+1]))
  md = int(s) % 2019
  if md == 0:#その数自身が割り切れた場合
    ans+=1
  ans += cnt(md)
  d[i] = md

print(ans)
  
  

### FIXED CODE ###

S = input()
size = len(S)
ans = 0
d = [0]*2019
pre = ''
ln = 0
v = 1
  
for i in range(1,size+1):
  md = (ln +(int(S[-1*i])*v))%2019
  d[md] += 1
  ln = md
  v *= 10
  v %= 2019

d[0] += 1
for i in range(2019):
  ans += d[i]*(d[i]-1)/2 #1~(n-1)までの和

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

import numpy as np

def main():
    N, K = map(int, input().split(" "))
    ps = np.array(input().split(" "))
    ps = ps.astype("int64")

    ps_means = np.zeros(N)
    maxval = 0

    for i in range(N):
        ps_means[i] = ((1 + ps[i]) * ps[i])/ 2
        if i + 1 >= K:
            sumval = np.sum(ps_means[i-K+1:i+1] / ps[i-K+1:i+1])
            if sumval > maxval:
                maxval = sumval

    ans = maxval
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import numpy as np
 
def main():
    N, K = map(int, input().split(" "))
    ps = np.array(input().split(" "))
    ps = ps.astype("int64")
 
    ps_means = np.zeros(N)
    maxval = 0
 
    for i in range(N):
        ps_means[i] = ((1 + ps[i]) * ps[i])/ 2
        if i + 1 >= K:
            if i + 1 == K:
                sumval = np.sum(ps_means[i-K+1:i+1] / ps[i-K+1:i+1])
            else:
                sumval -= ps_means[i-K] / ps[i-K]
                sumval += ps_means[i] / ps[i]
            if sumval > maxval:
                maxval = sumval
 
    ans = maxval
    print(ans)
 
if __name__ == '__main__':
    main()
### BUGGY CODE ###

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

for i in range(0,N-K):
    Ai_pre = 1
    Ai_cur = 1

    for j in range(0,K):
        Ai_pre = Ai_pre * Ai[i + j]

    for j in range(1,K + 1):
        Ai_cur = Ai_cur * Ai[i + j]

    if Ai_cur > Ai_pre:
        print("Yes")
    else:
        print("No")


### FIXED CODE ###

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

for i in range(0,N-K):

    if(Ai[i] < Ai[i+K]):
        print("Yes")
    else:
        print("No")
### BUGGY CODE ###

n,q = list(map(int,input().split()))
s = list(input())
num = list()
for i in range(0,q):
    num.append(list(map(int,input().split())))
check = list()
for i in range(0,n-1):
    if s[i] == "A" and s[i+1] == "C":
        check.append(i+1)
for i in range(0,q):
    count = 0
    for k in check:
        if num[i][1] <=k:
            break
        if num[i][0] <= k:
            count +=1
    print(count)

### FIXED CODE ###

n,q = list(map(int,input().split()))
s = list(input())
num = list()
check = [0]*n
for i in range(1,n):
        if s[i-1] == "A" and s[i] == "C":
                check[i] = check[i-1]+1
        else:
                check[i] = check[i-1]
ans = 0
for i in range(0,q):
        num = list(map(int,input().split()))
        ans = check[num[1]-1]-check[num[0]-1]
        print(ans)
### BUGGY CODE ###

H,W,M=map(int,input().split())
tgts=set()
for _ in range(M):
    i,j=map(int,input().split())
    tgts.add((i,j))

rows=[0]*(H+1)
cols=[0]*(W+1)

for i,j in tgts:
    rows[i]+=1
    cols[j]+=1

ii=max(rows)
jj=max(cols)

ia=[]
try:
    i=1
    while True:
        i=rows.index(ii,i)
        ia.append(i)
        i+=1
except:
    pass
    
ja=[]
try:
    j=1
    while True:
        j=cols.index(jj,j)
        ja.append(j)
        j+=1
except:
    pass



ans=0
for i in ia:
    for j in ja:
        k=rows[i]+cols[j]
        if (i,j) in tgts:
            k-=1
        ans=max(ans,k)

print(ans)


### FIXED CODE ###

from collections import defaultdict as ddict

ii=jj=0
ia,ja=[],[]
rows=ddict(int)
cols=ddict(int)
H,W,M=map(int,input().split())
tgts=set()
for _ in range(M):
    i,j=map(int,input().split())
    tgts.add((i,j))

    rows[i]+=1
    cols[j]+=1
    x=rows[i]
    if x>ii:
        ii=x
        ia=[i]
    elif x==ii:
        ia.append(i)
    y=cols[j]
    if y>jj:
        jj=y
        ja=[j]
    elif y==jj:
        ja.append(j)



ans=0
for i in ia:
    for j in ja:
        k=rows[i]+cols[j]
        if (i,j) in tgts:
            k-=1
        else:
            ans=k
            break
        ans=max(ans,k)

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

from collections import Counter

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

counter = Counter()
for a in A:
    counter += Counter([a-1, a, a+1])
print(counter.most_common()[0][1])


### FIXED CODE ###

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

C = [0 for _ in range(100000+2)]
for a in A:
    C[a] += 1
    C[a+1] += 1
    C[a+2] += 1
C.sort()
print(C[-1])