26 задача

сама задача (под номером 36)

https://inf-ege.sdamgia.ru/problem?id=48447


step = 5
 
#a = [10,9,9,8,7,6,4,4,2,1]
 
 
text1 = open("26.txt")
a = []
for i in text1:
    a.append(int(i))
 
     
a.sort(reverse=True)
 
k = 0
n_max = 0
while len(a) != 0:
    n = 1
    old = a[0]
    a_remove = []
    for i in a:
        d = (old - i)
        if d>=step:
            #print(i)
            n = n + 1
            old = i
            a_remove.append(i)
    for j in a_remove:
        a.remove(j)
    a.pop(0)
    #print(a)
    k = k + 1
 
    if n > n_max:
        n_max = n
         
print(k)
print(n_max)