You are a coach at your local university. There are $n$ students under your supervision, the programming skill of the $i$-th student is $a_i$.

You have to create a team for a new programming competition. As you know, the more students some team has the more probable its victory is! So you have to create a team with the maximum number of students. But you also know that a team should be balanced. It means that the programming skill of each pair of students in a created team should differ by no more than $5$.

Your task is to report the maximum possible number of students in a balanced team.


-----Input-----

The first line of the input contains one integer $n$ ($1 \le n \le 2 \cdot 10^5$) — the number of students.

The second line of the input contains $n$ integers $a_1, a_2, \dots, a_n$ ($1 \le a_i \le 10^9$), where $a_i$ is a programming skill of the $i$-th student.


-----Output-----

Print one integer — the maximum possible number of students in a balanced team.


-----Examples-----
Input
6
1 10 17 12 15 2

Output
3

Input
10
1337 1337 1337 1337 1337 1337 1337 1337 1337 1337

Output
10

Input
6
1 1000 10000 10 100 1000000000

Output
1



-----Note-----

In the first example you can create a team with skills $[12, 17, 15]$.

In the second example you can take all students in a team because their programming skills are equal.

In the third example you can create a team consisting of a single student (and you cannot create a team consisting of at least two students).

Difficulty: introductory

Starter code:

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

A.sort()
i = 0
j = 0
ans = 0

while j < len(A):
    ans = max(ans, j - i)
    if i == j or A[j] - A[i] <= 5:
        j += 1
    else:
        i += 1

print(max(ans, j - i))


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

maxsize = 0
j = 0
for i in range(len(a)):
    while a[i] - a[j] > 5:
        j += 1
    maxsize = max(maxsize, i - j + 1)

print(maxsize)


def main():
    n = int(input())
    arr = sorted(list(map(int, input().split())))
    ans = 0
    a = 0
    b = 0
    while b < n:
        if (arr[b] - arr[a] <= 5):
            ans = max(ans, b - a + 1)
            b += 1
        else:
            a += 1
    print(ans)
 
 
main()


n = int(input())
a = list(map(int, input().split()))
a.sort()
m = 0
i = 0
for j in range(n):
    while a[j] - a[i] > 5:
        i += 1
    m = max(m, j - i + 1)
print(m)

n = int(input())

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

d = {}

for c in a:
	d[c] = d.get(c, 0) + 1

b = []

mx = 0

for c in d:
	ans = 0
	for i in range(0, 6):
		ans += d.get(c + i, 0)
	if ans > mx:
		mx = ans

print(mx)


n = int(input())
ai = list(map(int,input().split()))
ai.sort()
ans = 0
for i in range(n-1,-1,-1):
    if ai[-1] - ai[i] > 5:
        break
    ans += 1
    
num = 0
num2 = 0
while num2 < n:
    if ai[num2] - ai[num] < 6:
        ans = max(ans, num2 - num + 1)
        num2 += 1
    else:
        num += 1
print(ans)


n = int(input())
A = list(map(int, input().split()))
z = {}
ans = 0
for i in range(n):
    if A[i] not in z:
        z[A[i]] = 0
    z[A[i]] += 1
for x in z:
    cnt = 0
    cnt += z[x]
    if x + 1 in z:
        cnt += z[x + 1]
    if x + 2 in z:
        cnt += z[x + 2]
    if x + 3 in z:
        cnt += z[x + 3]
    if x + 4 in z:
        cnt += z[x + 4]
    if x + 5 in z:
        cnt += z[x + 5]
    ans = max(ans, cnt)
print(ans)

n = int(input())
a = list(map(int, input().split()))
a.sort()
ans = 1
l = 0
r = 0
while(l < n - 1):
    if l > r:
        r = l
    while r < n - 1:
        if a[l] < a[r + 1] - 5:
            break
        r += 1
    if r - l + 1 > ans:
        ans = r - l + 1
    l += 1
print(ans)

n = int(input())
l = sorted(map(int, input().split()))
res = 0
i = 0
while i < n:
    j = i + 1
    while j < n and l[j] - l[i] <= 5:
        j += 1
    res = max(res, j - i)
    if j == n:
        break
    while i <= j and l[j] - l[i] > 5:
        i += 1
print(res)

n=int(input())
a=sorted(map(int,input().split()))
left,right=0,0
ans=1
while right<n-1:
    if a[right+1]-a[left]<=5:
        right+=1
        ans=max(ans,right-left+1)
    elif left<right:
        left+=1
    else:
        left+=1
        right+=1
print(ans)

n = int(input())
a = sorted(list(map(int, input().split())))
left, r = 0, 1
ans = 0
while r < n:
    while r < n and a[r] - a[left] <= 5:
        r += 1
    ans = max(ans, r - left)
    left += 1
print(max(ans, 1))


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

_min = 0
_max = 0
_dict = {}
for i in a:
    if _min < i-5:
        _max = max(_max, sum(_dict.values()))
        _dict = {key:value for key, value in _dict.items() if key >= i-5}
    _dict[i] = _dict[i] + 1 if i in _dict else 1
_max = max(_max, sum(_dict.values()))
print(_max)

#!/usr/bin/pypy
# -*- coding: utf-8 -*-


def main():
    input()
    nums = sorted(map(int, input().split()))
    ft = 0
    ans = 0
    for ed in range(len(nums)):
        num = nums[ed]
        while num > nums[ft] + 5:
            ft += 1
        ans = max(ans, ed - ft + 1)
    print(ans)


def __starting_point():
    main()

__starting_point()

# -*- coding: utf-8 -*-
# @Time    : 2019/3/7 23:26
# @Author  : LunaFire
# @Email   : gilgemesh2012@gmail.com
# @File    : C. Balanced Team.py

from collections import Counter


def main():
    n = int(input())
    a = list(map(int, input().split()))

    counter = Counter()
    for x in a:
        counter[x] += 1

    ret = 0
    for x in a:
        tmp = 0
        for i in range(6):
            tmp += counter[x + i]
        ret = max(ret, tmp)
    print(ret)


def __starting_point():
    main()
__starting_point()

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

i=0
j=0
ANS=0
while j<n:
    while j<n-1 and A[j+1]-A[i]<=5:
        j+=1
    ANS=max(ANS,j-i+1)
    i+=1
    j=max(j,i)

print(ANS)
    
        
    


n = int(input())
a = list(map(int, input().split()))
d = {}
for i in range(n):
    if a[i] not in d:
        d[a[i]] = 1
    else:
        d[a[i]] += 1

num = 0
for k in list(d.keys()):
    tmp = 0
    for j in range(k, k + 6):
        if j in d:
            tmp += d[j]
    num = max(num, tmp)

print(num)



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


A.sort()

ans = 0

cur_min_idx = 0
cur_students = 1

idx = 1
while idx < n:
    if A[idx] - A[cur_min_idx] <= 5:
        cur_students += 1
        idx += 1
    else:
        cur_min_idx += 1
        cur_students -= 1

    ans = max(ans, cur_students)

ans = max(ans, cur_students)

print(ans)

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

l.sort()

maxs = 1
min_el = l[0]
min_ind = 0

s = 1

for i in range(1,len(l)):
    if l[i] - min_el <= 5:
        s += 1
    else:
        min_el = l[min_ind+1]
        min_ind = min_ind+1
        
    maxs = max(maxs,s)
    
maxs = max(maxs,s)

print(maxs)


n = int(input())

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

D = {}

for i in L:
    if i in D:
        D[i] += 1
    else:
        D[i] = 1
        
best = 0

for i in D:
    temp = 0
    for j in range(6):
        temp += D.get(i+j,0)
    best = max(best,temp)
        
print(best)

n = int(input())
arr = sorted(map(int, input().split()))
freq = {}
for x in arr:
    freq[x] = freq.get(x, 0)+1
arr = sorted(freq.keys())

j = 0
curr = 0
while j < len(arr) and abs(arr[j]-arr[0] <= 5):
    curr += freq[arr[j]]
    j += 1

i = 1
ans = curr
while i < len(arr):
    curr -= freq[arr[i-1]]
    while j < len(arr) and abs(arr[j]-arr[i] <= 5):
        curr += freq[arr[j]]
        j += 1
    ans = max(ans, curr)
    i += 1
print(ans)

n=int(input())
a=list(map(int,input().split()))
a=sorted(a);m=0
from bisect import bisect
for i in range(n):
    m=max(m,bisect(a,a[i]+5)-i)
print(m)


#map(int,input().split())
#int(input())
n=int(input())
a=list(map(int,input().split()))
a.sort()
cm = 0
ans = 1
i=1
while i<n:
    if a[i]-a[cm]<=5:
       i+=1
       ans = max(i-cm,ans)
    else:
       while cm <= i and a[i] - a[cm]>5:
             cm+=1
print(ans)

n= int(input())
a = [int(x) for x in input().split()]
a.sort()
p1,p2=0,0
r=1
while p2 < n-1:
    p2 += 1
    while a[p2] - a[p1] > 5:
        p1 += 1
    r = max(r, p2-p1+1)
print(r)

n=int(input().strip())
numbers=list(map(int,input().strip().split(" ")))
numbers.sort()
start=0
current=0
l=[]
tot=0
while (current<len(numbers) and start<len(numbers)):
    if(numbers[current]-numbers[start]>5):
        start=start+1
        l.append(tot)
        tot-=1
    else:
        tot+=1
        current+=1
if(len(l)>0):
    print(max(tot,max(l)))
else:
    print(tot)