16 lines
236 B
Python
16 lines
236 B
Python
n, k = map(int, input().split(" "))
|
|
arr = [int(x) for x in input().strip().split()]
|
|
|
|
arr.sort()
|
|
|
|
pairs = 0
|
|
i = 0
|
|
while i < n - 1:
|
|
if arr[i + 1] - arr[i] <= k:
|
|
pairs += 1
|
|
i += 2
|
|
else:
|
|
i += 1
|
|
|
|
print(pairs)
|