# Task
  You are given `N` ropes, where the length of each rope is a positive integer. At each step, you have to reduce all the ropes by the length of the smallest rope.

 The step will be repeated until no ropes are left. Given the length of N ropes, print the number of ropes that are left before each step.

# Example

 For `a = [3, 3, 2, 9, 7]`, the result should be `[5, 4, 2, 1]`
 ```
You have 5 ropes:       
                   3 3 2 9 7   ( 5 left)
step 1:          1 1 0 7 5   ( 4 left)
step 2:          0 0 0 6 4   ( 2 left)
step 3:          0 0 0 0 2   ( 1 left)
step 4:          0 0 0 0 0    
Hence the result is [5, 4, 2, 1]```

# Input/Output
  
 - `[input]` integer array `a`

  length of each rope.
  
  `3 <= a.length <= 2000`
  
  `1 <= a[i] <= 100`


 - `[output]` an integer array

  number of ropes before each step.

Difficulty: EASY
Starter code: def cut_the_ropes(arr):
	

Solutions:
def cut_the_ropes(arr):
	results = [len(arr)]
	while arr:
		m = min(arr)
		arr = [elem - m for elem in arr if elem != m]
		results.append(len(arr))
	return results[:-1]


def cut_the_ropes(arr):
	qty = len(arr)
	sorted_ropes = sorted(arr)
	return [qty - sorted_ropes.index(n) for n in sorted(set(arr))]


def cut_the_ropes(a):
	if not a:
		return []
	m = min(a)
	return [len(a)] + cut_the_ropes([x - m for x in a if x > m])


def cut_the_ropes(a):
	result = []
	while a:
		result.append(len(a))
		m = min(a)
		a = [x - m for x in a if x > m]
	return result


def cut_the_ropes(arr):
	res = []
	while arr:
		(res, m) = (res + [len(arr)], min(arr))
		arr = [l - m for l in arr if l > m]
	return res


def cut_the_ropes(arr):
	ans = []
	while arr:
		ans.append(len(arr))
		minRope = min(arr)
		arr = [elt - minRope for elt in arr if elt > minRope]
	return ans


from itertools import accumulate, chain, groupby

def cut_the_ropes(arr):
	return list(accumulate(chain((len(arr),), groupby(sorted(arr))), lambda a, b: a - sum((1 for __ in b[1]))))[:-1]


from itertools import groupby
from functools import reduce

def cut_the_ropes(arr):
	return reduce(lambda a, g: a + [a[-1] - sum((1 for __ in g[1]))], groupby(sorted(arr)), [len(arr)])[:-1]


def cut_the_ropes(arr):
	counts = []
	while arr:
		counts.append(len(arr))
		m = min(arr)
		arr = [rope - m for rope in arr if rope - m > 0]
	return counts


def cut_the_ropes(a):
	r = []
	while a:
		r.append(len(a))
		n = min(a)
		a = [x - n for x in a if x != n]
	return r