# Your Task
You have a Petri dish with bacteria, and you are preparing to dive into the harsh micro-world. But, unfortunately, you don't have any microscope nearby, so you can't watch them.

You know that you have `n` bacteria in the Petri dish and size of the i-th bacteria is bacteriai. Also you know intergalactic positive integer constant `K`.

The i-th bacteria can swallow the j-th bacteria if and only if bacteriai > bacteriaj and bacteriai ≤ bacteriaj + K. The j-th bacteria disappear, but the i-th bacteria doesn't change its size.

Since you don't have a microscope, you can only guess the minimal possible number of bacteria that will remain in your Petri dish when you finally find a microscope.

```python
micro_world([101, 53, 42, 102, 101, 55, 54], 1) == 3
micro_world([20, 15, 10, 15, 20, 25], 5) == 1
```

___

# Explanation
```python
bacteria = [101, 53, 42, 102, 101, 55, 54]
K = 1
```

```if:cpp
The one of possible sequences of swallows is: {101,53,42,102,101,55,54} → {101,53,42,102,55,54} → {101,42,102,55,54} → {42,102,55,54} → {42,102,55}. In total there are 3 bacteria remaining.
```
```if:python,ruby,javascript
The one of possible sequences of swallows is: [101,53,42,102,101,55,54] → [101,53,42,102,55,54] → [101,42,102,55,54] → [42,102,55,54] → [42,102,55]. In total there are 3 bacteria remaining.
```

Difficulty: introductory

Starter code:

def micro_world(bacteria, k):
	

Solutions:
def micro_world(bacteria, k):
    return sum(1 for e in bacteria if not [j for j in bacteria if e<j<=e+k])


def micro_world(bact, k):
    bact = sorted(bact)
    return sum(1 for i, a in enumerate(bact) if all(a == b or a + k < b for b in bact[i+1:]))

from collections import Counter

def micro_world(bacteria, k):
    L = sorted(Counter(bacteria).items())
    return sum(v1 for (k1,v1),(k2,_) in zip(L, L[1:]) if k2 > k1+k) + L[-1][1]

from collections import Counter

def micro_world(bs, k):
    c = Counter(bs)
    ns = sorted(c)
    return sum((x + k < bigger) * c[x] for x, bigger in zip(ns, ns[1:] + [float('inf')]))


def micro_world(bacteria, k):
    for i in list(bacteria):
        bacteria = [x for x in bacteria if not (i > x and i -k <= x) or x == i]
        
    return len(bacteria)

import numpy as np

def micro_world(bacteria, k):
    bacteria = np.array(sorted(bacteria))
    for index, j in enumerate(bacteria):
        if j < 0:
            continue
        for i in bacteria[index:]:
            if i > j and i <= j + k:
                bacteria[bacteria == j] = -1
                break
    return len(list(filter(lambda x: x > 0, bacteria)))

def micro_world(bacteria, k):
    i = 0
    j = 1
    bacteria = sorted(bacteria)
    
    while i < len(bacteria) - 1:
        if bacteria[i] == bacteria [i+j]:
            j += 1
            if i + j > len(bacteria) - 1:
                break
        else:
            if bacteria[i] < bacteria[i+j] <= bacteria[i] + k:
                bacteria.remove(bacteria[i])
            else:
                i += 1
            j = 1
    
    return len(bacteria)

def micro_world(bacteria, k):
    b = sorted(bacteria)
    f, leng = 0, len(b)
    for i, e in enumerate(b[:-1]):
        if e < b[i+1] and e + k >= b[i+1]:
            leng = leng - 1 - f
            f = 0
        elif e == b[i+1]:
            f += 1
        else:
            f = 0
    return leng

def micro_world(bacteria, k):
    bacteria.sort()
    while True:
        last = len(bacteria)
        for j in range(len(bacteria)):
            has_eat = False
            for i in range(j+1, len(bacteria)):
                if bacteria[i] > bacteria[j] and bacteria[i] <= k+bacteria[j]:
                    bacteria.remove(bacteria[j])
                    has_eat = True
                    break
            if has_eat:
                break
        if len(bacteria) == last:
            break
    return len(bacteria)

def micro_world(arr,k):
    x = arr.copy()
    for i in arr:
        for j in range(i-k,i):
            while j in x:
                x.remove(j)
    return len(x)