#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
int main() {
const int L = 5;
vector<int> v = { 1, 10, 11, 2 };
const int N = v.size();
sort(v.begin(), v.end());
// the algo tries to include elements in interval of length 2 * L
int ans = 0;
int first = 0;
for(int i = 1; i < N; ++i) {
if(v[i] - v[first] > 2 * L) { // if we can't include i-th element
ans++; // into the current interval
first = i; // the algo construct new
}
}
ans++;
printf("%d", ans);
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8YWxnb3JpdGhtPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKSB7Cgljb25zdCBpbnQgTCA9IDU7Cgl2ZWN0b3I8aW50PiB2ID0geyAxLCAxMCwgMTEsIDIgfTsKCWNvbnN0IGludCBOID0gdi5zaXplKCk7CgoJc29ydCh2LmJlZ2luKCksIHYuZW5kKCkpOwovLyB0aGUgYWxnbyB0cmllcyB0byBpbmNsdWRlIGVsZW1lbnRzIGluIGludGVydmFsIG9mIGxlbmd0aCAyICogTAppbnQgYW5zID0gMDsKaW50IGZpcnN0ID0gMDsgCmZvcihpbnQgaSA9IDE7IGkgPCBOOyArK2kpIHsKICAgIGlmKHZbaV0gLSB2W2ZpcnN0XSA+IDIgKiBMKSB7IC8vIGlmIHdlIGNhbid0IGluY2x1ZGUgaS10aCBlbGVtZW50IAogICAgICAgIGFucysrOyAgICAgICAgICAgICAgICAgICAgLy8gaW50byB0aGUgY3VycmVudCBpbnRlcnZhbCAgIAogICAgICAgIGZpcnN0ID0gaTsgICAgICAgICAgICAgICAgLy8gdGhlIGFsZ28gY29uc3RydWN0IG5ldyAKICAgIH0KfQphbnMrKzsKcHJpbnRmKCIlZCIsIGFucyk7Cn0=