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

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

from math import sqrt

def cross3(a, b, c):
    return (b[0]-a[0])*(c[1]-a[1]) - (b[1]-a[1])*(c[0]-a[0])

# ps = [(x, y), ...]: ソートされた座標list
def convex_hull(ps):
    qs = []
    N = len(ps)
    for p in ps:
        # 一直線上で高々2点にする場合は ">=" にする
        while len(qs) > 1 and cross3(qs[-1], qs[-2], p) >= 0:
            qs.pop()
        qs.append(p)
    t = len(qs)
    for i in range(N-2, -1, -1):
        p = ps[i]
        while len(qs) > t and cross3(qs[-1], qs[-2], p) >= 0:
            qs.pop()
        qs.append(p)
    return qs

def dist(a, b):
    return abs(a[0]-b[0]) + abs(a[1]-b[1])
def cross(a, b, c, d):
    return (b[0]-a[0])*(d[1]-c[1]) - (b[1]-a[1])*(d[0]-c[0])
def rotating_calipers(ps):
    qs = convex_hull(ps)
    n = len(qs)
    if n == 2:
        return dist(qs[0], qs[1])
    i = j = 0
    for k in range(n):
        if qs[k] < qs[i]: i = k
        if qs[j] < qs[k]: j = k
    res = 0
    si = i; sj = j
    while i != sj or j != si:
        res = max(res, dist(qs[i], qs[j]))
        if cross(qs[i], qs[i-n+1], qs[j], qs[j-n+1]) < 0:
            i = (i + 1) % n
        else:
            j = (j + 1) % n
    return res

def main():
    N = int(readline())
    m = map(int,read().split())
    XY = list(zip(m,m))

    XY.sort()
    # cf = convex_hull(XY)
    # print(cf)
    ans = rotating_calipers(XY)
    print(ans)

if __name__ == '__main__':
    main()

### FIXED CODE ###

import sys
read = sys.stdin.buffer.read
readline = sys.stdin.buffer.readline
readlines = sys.stdin.buffer.readlines

def main():
    N = int(readline())
    m = map(int,read().split())
    XY = list(zip(m,m))

    ans = 0
    z = [x-y for (x, y) in XY]
    # print(z)
    z.sort()
    ans = z[-1] - z[0]
    z = [x+y for (x, y) in XY]
    # print(z)
    z.sort()
    ans = max(ans, z[-1] - z[0])

    print(ans)

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

n,k = map(int,input().split())
p = list(map(int,input().split()))
kitaichi = []
for i in range(n):
    P = p[i]
    kitai = (1+P)/2
    kitaichi.append(kitai)
ans = []
for j in range((n-k)+1):
    a = sum(kitaichi[j:j+k])
    ans.append(a)
ans.sort(reverse=True)

print(ans[0])


### FIXED CODE ###

n,k = map(int,input().split())
p = list(map(int,input().split()))
kitaichi = []
for i in range(n):
    P = p[i]
    kitai = 1+P
    kitaichi.append(kitai)
m = [0,]
a = 0
for j in range(n):
    a += kitaichi[j]
    m.append(a)
ans = 0
for l in range(n-k+1):
    temp = m[l+k]-m[l]
    if temp> ans:
      ans = temp
print(ans/2)
### BUGGY CODE ###

#!/usr/bin/env python3

N, M = list(map(int, input().split()))
a_list = list(map(int, input().split()))

for _ in range(M):
    a_list = sorted(a_list, reverse=True)
    a_list[0] = a_list[0] // 2

ans = sum(a_list)
print(ans)


### FIXED CODE ###

#!/usr/bin/env python3
import heapq

N, M = list(map(int, input().split()))
a_list = list(map(int, input().split()))

# Pythonのheapqは最小値しかとれないので、負の値に変換して扱う
a_list = list(map(lambda x: x * (-1), a_list))
heapq.heapify(a_list)

for _ in range(M):
    max_value = -heapq.heappop(a_list)
    heapq.heappush(a_list, -(max_value // 2))

ans = -sum(a_list)
print(ans)
### BUGGY CODE ###

N = int(input())

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

ans = 0
for i in range(N):
  for j in range(max(i,A[i]+1),N):
    if j -i  == A[i]+A[j]:
      ans += 1
print(ans)

### FIXED CODE ###

N = int(input())

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

L = {}
R = {}

for i in range(N):
  t = A[i]+i
  if t in L:
    L[t] += 1
  else:
    L[t] = 1
  s = i - A[i]
  if s in R:
    R[s] += 1
  else:
    R[s] = 1  
#print(L,R)
ans = 0
for i in range(N):
  t = A[i]+i
  #ans += R[t]
  if t in R.keys():
    ans += R[t]
    #print(t,R[t])
print(ans)
### BUGGY CODE ###

import math
import sys
input = lambda: sys.stdin.readline().rstrip()
n = int(input())
ai = [int(i) for i in input().split()]

num_li = [0]*(10**6+1)


def make_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



for i in range(n):
    num_li[ai[i]] += 1

ans = 0
    
for i in range(n):
    if num_li[ai[i]] > 1:
        continue
    #print(ai[i])
    flag = True
    div = make_divisors(ai[i])
    #print(div)
    for j in range(len(div)):
        if div[j] == ai[i]:
            continue
        #print(div[j],div)
        if num_li[div[j]] > 0:
            flag = False
            break
    if flag == True:
        ans += 1
    #exit()
print(ans)


### FIXED CODE ###

import math
n = int(input())
ai = [int(i) for i in input().split()]

ai.sort()

sqr_max_val = int(ai[n-1]**0.5)
max_val = ai[n-1]
#print(ai)
ai_ex = [0]*(2*10**6)
#ai_ex = [0]*(30)

for i in range(n):
    ai_ex[ai[i]-1] += 1

for i in range(n):
    if ai_ex[ai[i]-1] > 1:
        ai_ex[ai[i]-1] = 0
    """
    if ai[i] > sqr_max_val:
        break
    """
    tmp = ai[i]
    baisu = 2
    #print(ai[i])
    while tmp * baisu <=  max_val:
        ai_ex[tmp*baisu-1] = 0
        #print(tmp*baisu)
        baisu += 1
"""
for i in range(100):
    if ai_ex[i] == 1:
        a = 1
        #print(i)
"""
print(sum(ai_ex))
#print(ai_ex)
### BUGGY CODE ###

N, M = map(int, input().split())
A = [int(i) for i in input().split()]
for _ in range(M):
  B, C = map(int, input().split())
  A.extend([C]*B)
  
A = sorted(A, reverse=True)
print(sum(A[:N]))

### FIXED CODE ###

N, M = map(int, input().split())
A = [int(i) for i in input().split()]
BC = []
for _ in range(M):
    B, C = map(int, input().split())
    BC.append([B, C])
BC = sorted(BC, key=lambda x: x[1], reverse=True)
# print("A: {}".format(A))
# print("BC: {}".format(BC))

A_dash = []
for ij in BC:
    i, j = ij
    A_dash.extend([j]*i)
    if len(A_dash) >= N:
        break
A_dash = A_dash[:N]

A_dash.extend(A)
A_dash = sorted(A_dash, reverse=True)[:N]

print(sum(A_dash))
### BUGGY CODE ###

import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=998244353
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,p=LI()
  s=S()

  ans=0
  if p==2 or p==5:
    for i,x in enumerate(s):
      if int(x)%p==0:
        ans+=i+1
    return ans

  _s=list(s)
  _s.reverse()

  a=[]
  i=1
  for x in _s:
    b=(i*int(x))%p
    a.append(b)
    i*=10%p

  b=[0]*p
  b[a[0]%p]=1
  for i in range(n-1):
    a[i+1]+=a[i]
    a[i+1]%=p
    b[a[i+1]]+=1

  for i,x in enumerate(b):
    if i==0:
      ans+=x
    if x>1:
      ans+=x*(x-1)//2

  return ans

# main()
print(main())


### FIXED CODE ###

import math,itertools,fractions,heapq,collections,bisect,sys,queue,copy

sys.setrecursionlimit(10**7)
inf=10**20
mod=998244353
dd=[(-1,0),(0,1),(1,0),(0,-1)]
ddn=[(-1,0),(-1,1),(0,1),(1,1),(1,0),(1,-1),(0,-1),(-1,-1)]

def LI(): return [int(x) for x in sys.stdin.readline().split()]
def I(): return int(sys.stdin.readline())
def LS(): return sys.stdin.readline().split()
def S(): return input()

def main():
  n,p=LI()
  s=S()

  ans=0
  if p==2 or p==5:
    for i,x in enumerate(s):
      if int(x)%p==0:
        ans+=i+1
    return ans

  _s=list(s)
  _s.reverse()

  a=[]
  i=1
  for x in _s:
    b=(i*int(x))%p
    a.append(b)
    i*=10
    i%=p

  b=[0]*p
  b[a[0]%p]=1
  for i in range(n-1):
    a[i+1]+=a[i]
    a[i+1]%=p
    b[a[i+1]]+=1

  for i,x in enumerate(b):
    if i==0:
      ans+=x
    if x>1:
      ans+=x*(x-1)//2

  return ans

# main()
print(main())
### BUGGY CODE ###

n=input()
l=len(n)
n=int(n)
data=[["0"]*l for i in range(4**l)]
for i in range(4**l):
    k=i
    for j in range(l):
        a=k//4**(l-1-j)
        if a==1:
            data[i][j]="3"
        if a==2:
            data[i][j]="5"
        if a==3:
            data[i][j]="7"
        k%=4**(l-1-j)
ans=0
for u in data:
    num=int("".join(u))
    if num<=n:
        num=str(num)
        if "0" not in num and "3" in num and "5" in num and "7" in num:
            ans+=1
print(ans)

### FIXED CODE ###

n=input()
l=len(n)
n=int(n)
data=[["0"]*l for i in range(4**l)]
for i in range(4**l):
    k=i
    for j in range(l):
        a=k//4**(l-1-j)
        if a==1:
            data[i][j]="3"
        if a==2:
            data[i][j]="5"
        if a==3:
            data[i][j]="7"
        k%=4**(l-1-j)
ans=0
for u in data:
    num=int("".join(u))
    if num<=n:
        num=str(num)
        if "0" not in num and "3" in num and "5" in num and "7" in num:
            ans+=1
print(ans)
### BUGGY CODE ###

H, W = map(int, input().split())
M = [list(input()) for _ in range(H)]

black = []
for i in range(H):
  for j in range(W):
    if M[i][j] == '#':
      black.append((i, j))
      
ans = 0

while any('.' in m for m in M):
  ans += 1
  next_black = []
  while black:
    bi, bj = black.pop(0)
    for i, j in [(bi - 1, bj), (bi + 1, bj), (bi, bj - 1), (bi, bj + 1)]:
      if i >= 0 and i < H and j >= 0 and j < W:
        if M[i][j] == '.':
          M[i][j] = '#'
          next_black.append((i, j))
  black = next_black
  
print(ans)



### FIXED CODE ###

from collections import deque
import copy
 
def main():
    h, w = map(int, input().split())
    a = [[j == "#" for j in input()] for _ in range(h)]
 
 
    que = deque([(i, j) for i in range(h) for j in range(w) if a[i][j]])
 
    count = 0
    while True:
        count += 1
        nque = deque()
        while que:
            y, x = que.popleft()
            if x > 0 and not a[y][x-1]:
                a[y][x-1] = True
                nque.append((y,x-1))
            if x < w-1 and not a[y][x+1]:
                a[y][x+1] = True
                nque.append((y,x+1))
            if y > 0 and not a[y-1][x]:
                a[y-1][x] = True
                nque.append((y-1,x))
            if y < h-1 and not a[y+1][x]:
                a[y+1][x] = True
                nque.append((y+1,x))
 
        if nque:
            que = copy.copy(nque)
        else:
            break
 
    print(count - 1)

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

n=int(input())
p=1
for i in range(1,n+1):
  p=p*i
  if p>1000000007:
    p=p-1000000007
print(p%1000000007)

### FIXED CODE ###

import math
print(math.factorial(int(input()))%(10**9+7))
### BUGGY CODE ###

q = int(input())


def primes(n):
    ass = []
    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
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass


for _ in range(q):
    l, r = map(int, input().split())
    count = 0
    prime_list = primes(r+1)
    #print(prime_list)
    for p in prime_list:
        if p >= l:
            pp = (p+1)//2
            if pp in prime_list:
                count += 1
    print(count)


### FIXED CODE ###

q = int(input())


def primes(n):
    ass = []
    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
    for i in range(len(is_prime)):
        if is_prime[i]:
            ass.append(i)
    return ass


prime_list = primes(100000)
familiar = [0]*100001
for p in prime_list:
    if (p+1)//2 in prime_list:
        familiar[p] = 1
s = [0]*100001
for i in range(100000):
    s[i+1] = s[i] + familiar[i+1]


for _ in range(q):
    l, r = map(int, input().split())
    print(s[r]-s[l-1])
### BUGGY CODE ###

n=int(input())
lst=list(map(int,input().split()))
count=0
for i in range(n-2):
    for j in range(1,n-1):
        for k in range(2,n):
            if i<j<k:                
                a=lst[i]
                b=lst[j]
                c=lst[k]
                if a<b+c and b<c+a and c<a+b:
                    count+=1
print(count)


### FIXED CODE ###

import bisect
n=int(input())
l=list(map(int,input().split()))
l.sort()
ans=0
for i in range(0,n-2):
    for j in range(i+1,n-1):
        x=l[i]+l[j]
        y=bisect.bisect_left(l,x)-j-1        
        ans+=y
print(ans)
### BUGGY CODE ###

n = int(input())
l = sorted(list(map(int,input().split())))
cnt = 0
for i in range(n):
    for j in range(i+1,n):
        for k in range(j+1,n):
            a = l[i]
            b = l[j]
            c = l[k]
            if a-b<c and c<a+b:
                cnt+=1
print(cnt)

### FIXED CODE ###

import bisect
n = int(input())
l = list(map(int,input().split()))
cnt = 0
l = sorted(l)
for i in range(n):
    for j in range(i+1,n):
        d = l[i]+ l[j]
        cnt +=bisect.bisect_left(l,d) - (j+1)
print(cnt)
### BUGGY CODE ###

import re

N, Q = map(int, input().split())
S = input()
li = [list(map(int, input().split())) for n in range(Q)]

pattern = "AC"

for i in li:
  s = S[i[0]-1:i[1]]
  count = 0
  
  for index, k in enumerate(s):
    if index == len(s) - 1:
      break

    if k == 'A' and s[index+1] == 'C':
      count += 1

  print(count)

### FIXED CODE ###

N, Q = map(int, input().split())
S = input()
li = [list(map(int, input().split())) for n in range(Q)]

t = [0] * len(S)

for index, s in enumerate(S):
  if index+1 > len(S)-1:
    break

  if s == 'A' and S[index+1] == 'C':
    t[index+1] = t[index] + 1
    
  else:
    t[index+1] = t[index]

for i in li:
  print(t[i[1]-1] - t[i[0] - 1])
### BUGGY CODE ###

# -*- coding: utf-8 -*-
n,p = input().split()
n = int(n)
p = int(p)
i = 2
a = o = 1
while a<p:
    a = i**n
    if p%a==0:
        o = i
    i += 1
print(o)

### FIXED CODE ###

# -*- coding: utf-8 -*-
n,p = list(map(int,input().split())) 
i = a = o = 1
m = round(p**(1/n))
for i in range(m,0,-1):
    a = i**n
    if p%a==0:
        print(i)
        exit()
### BUGGY CODE ###

def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

b,w=map(int,input().split())
x=0
y=0
for i in range(1,b+w+1):
  x=(x*2+cmb(i-2,b-1))%mod
  y=(y*2+cmb(i-2,w-1))%mod
  print((mod+pow(2,i-1,mod)-x+y)*pow(pow(2,i,mod),mod-2,mod)%mod)

### FIXED CODE ###

def cmb(n, r):
    if ( r<0 or r>n ):
        return 0
    r = min(r, n-r)
    return g1[n] * g2[r] * g2[n-r] % mod

mod = 10**9+7 #出力の制限
N = 2*10**5
g1 = [1, 1] # 元テーブル
g2 = [1, 1] #逆元テーブル
inverse = [0, 1] #逆元テーブル計算用テーブル

for i in range( 2, N + 1 ):
    g1.append( ( g1[-1] * i ) % mod )
    inverse.append( ( -inverse[mod % i] * (mod//i) ) % mod )
    g2.append( (g2[-1] * inverse[-1]) % mod )

b,w=map(int,input().split())
x=0
y=0
for i in range(1,b+w+1):
  x=(x*2+cmb(i-2,b-1))%mod
  y=(y*2+cmb(i-2,w-1))%mod
  print((mod+pow(2,i-1,mod)-x+y)*pow(pow(2,i,mod),mod-2,mod)%mod)
### BUGGY CODE ###

n=int(input())
def l(k):
  if k==1:
    return 1
  elif k==0:
    return 2
  else:
    return l(k-1)+l(k-2)
print(l(n))

### FIXED CODE ###

n=int(input())
for i in range(n+1):
  if i==0:
    a=2
  elif i==1:
    b=1
  else:
    a,b=b,a+b
print(b)
### BUGGY CODE ###

x = int(input())
y = 0
while 100 < x:
    m = 100*101//100
    y+= 1
print(y)

### FIXED CODE ###

X = int(input())
s = 100
c = 0
while s < X:
  s = s + s  // 100
  c = c + 1
print(c)
### BUGGY CODE ###

from decimal import *
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

M = mod = 998244353
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
def li4():return [Decimal(i) for i in input().rstrip('\n').split(' ')]

n = val()
l = li4()
mihe = n//2 + 1


dp = [[Decimal(0) for i in range(n)] for j in range(n + 1)]
sumarray = [Decimal(1) for i in range(n + 1)]



for i in range(n-1,-1,-1):
    for j in range(n-1,i - 1,-1):
        dp[i][j] = ( l[i] / (1 - l[i]) ) * sumarray[j + 1]

    for j in range(n):
        if sumarray[j] != 1:
            sumarray[j] += dp[i][j]
        else:
            sumarray[j] = dp[i][j]



# for i in dp:print(*i)
# print(*sumarray)

curr = 1
for i in l:curr *= (1 - i)

print(sum(j * curr for j in sumarray[:- mihe]))


### FIXED CODE ###

from decimal import *
from bisect import bisect_left as bl
from bisect import bisect_right as br
from heapq import heappush,heappop
import math
from collections import *
from functools import reduce,cmp_to_key
import sys
input = sys.stdin.readline

M = mod = 998244353
def factors(n):return sorted(set(reduce(list.__add__, ([i, n//i] for i in range(1, int(n**0.5) + 1) if n % i == 0))))
def inv_mod(n):return pow(n, mod - 2, mod)

def li():return [int(i) for i in input().rstrip('\n').split()]
def st():return input().rstrip('\n')
def val():return int(input().rstrip('\n'))
def li2():return [i for i in input().rstrip('\n')]
def li3():return [int(i) for i in input().rstrip('\n')]
def li4():return [float(i) for i in input().rstrip('\n').split(' ')]

n = val()
l = li4()
mihe = n//2 + 1


curr = 1
for i in l:curr *= (1 - i)
dp = [0 for i in range(n + 1)]
dp[0] = 1

for i in range(n):

    for j in range(i + 1,-1,-1):
        if not j:dp[j] *= 1 - l[i]
        else:dp[j] = dp[j-1] * l[i] + dp[j] *(1 - l[i])

ans = 0
for i in dp[-mihe:]:
    ans += i

print(round(ans,10))
### BUGGY CODE ###

n = input()
nums = map(int, input().split())
 
num_dvd = 0
 
can_devide = True
temp_list = []
while can_devide is True:
  for num in nums:
    if num % 2 == 1:
      print(num_dvd)
      can_devide == False
    else:
      temp_list.append(num // 2)
  num_dvd += 1
  nums, temp_list = temp_list, []

### FIXED CODE ###

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

num_dvd = 0
 
can_devide = True
temp_list = []
while can_devide:
  for num in nums:
    if num % 2 == 1:
      can_devide = False
      print(num_dvd)
      break
    else:
      temp_list.append(num // 2)
  num_dvd += 1
  nums, temp_list = temp_list, []
### BUGGY CODE ###

# coding: utf-8
N, X, Y = map(int, input().split())
list = []
for i in range(1,N):
    for j in range(i+1,N+1):
        list.append(min(j-i, abs(X-i)+1+abs(Y-j)))
for k in range(1,N):
    print(list.count(k))

### FIXED CODE ###

# coding: utf-8
N, X, Y = map(int, input().split())
ans = [0]*N
for i in range(1,N):
    for j in range(i+1,N+1):
        l = min(j-i, abs(X-i)+1+abs(Y-j))
        ans[l] += 1
for k in range(1,N):
    print(ans[k])
### BUGGY CODE ###

def solve(string):
    n, *a = map(int, string.split())
    ans = n * 10**9
    for i in range(1, n - 2):
        for j in range(2, n - 1):
            for k in range(3, n):
                s = [sum(a[:i]), sum(a[i:j]), sum(a[j:k]), sum(a[k:])]
                ans = min(ans, max(s) - min(s))
    return str(ans)


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))


### FIXED CODE ###

def solve(string):
    n, *a = map(int, string.split())
    l, c, r = 1, 2, 3
    sll, slr, srl, srr = sum(a[:l]), sum(a[l:c]), sum(a[c:r]), sum(a[r:])
    ans = max(sll, slr, srl, srr) - min(sll, slr, srl, srr)
    while c < n - 1:
        d = abs(sll - slr)
        dn = abs(sll + 2 * a[l] - slr)
        while dn < d:
            sll, slr = sll + a[l], slr - a[l]
            l += 1
            d = abs(sll - slr)
            dn = abs(sll + 2 * a[l] - slr)
        d = abs(srl - srr)
        dn = abs(srl + 2 * a[r] - srr)
        while dn < d:
            srl, srr = srl + a[r], srr - a[r]
            r += 1
            d = abs(srl - srr)
            dn = abs(srl + 2 * a[r] - srr)
        ans = min(ans, max(sll, slr, srl, srr) - min(sll, slr, srl, srr))
        slr += a[c]
        srl -= a[c]
        c += 1
    return str(ans)


if __name__ == '__main__':
    print(solve('\n'.join([input(), input()])))
### BUGGY CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-


def main():
  input()
  values = list(map(int, input().split()))
  values.sort()
  result = 0

  for i in range(len(values) - 2):
    for j in range(i + 1, len(values) - 1):
      for k in range(j + 1, len(values)):
        if (values[i] < values[j] + values[k]
            and values[j] < values[i] + values[k]
            and values[k] < values[i] + values[j]):
          result += 1

  print(result)


if __name__ == '__main__':
  main()


### FIXED CODE ###

#!/usr/bin/env python
# -*- coding: utf-8 -*-
import bisect


def main():
  input()
  values = list(map(int, input().split()))
  values.sort()
  result = 0

  for i in range(len(values) - 2):
    for j in range(i + 1, len(values) - 1):
      targets = values[j + 1:]
      index = bisect.bisect_left(targets, values[i] + values[j])
      result += index

  print(result)


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

N = int(input())
a = list(map(int, input().split()))
ans = 0

for k in range(min(a) - 1, max(a) + 2):
	ans = max(ans, a.count(k) + a.count(k + 1) + a.count(k - 1))
	ans = max(ans, a.count(k - 1) + a.count(k) + a.count(k - 2))
	ans = max(ans, a.count(k + 1) + a.count(k + 2) + a.count(k))

print(ans)


### FIXED CODE ###

from bisect import bisect_left, bisect_right

N = int(input())
a = sorted(list(map(int, input().split())))

ans = 1
for i in range(N):
    X = a[i]
    res = bisect_right(a, X+1) - bisect_left(a, X-1)
    ans = max(res, ans)

print(ans)