Vasya learns to type. He has an unusual keyboard at his disposal: it is rectangular and it has n rows of keys containing m keys in each row. Besides, the keys are of two types. Some of the keys have lowercase Latin letters on them and some of the keys work like the "Shift" key on standard keyboards, that is, they make lowercase letters uppercase.Vasya can press one or two keys with one hand. However, he can only press two keys if the Euclidean distance between the centers of the keys does not exceed x. The keys are considered as squares with a side equal to 1. There are no empty spaces between neighbouring keys.Vasya is a very lazy boy, that's why he tries to type with one hand as he eats chips with his other one. However, it is possible that some symbol can't be typed with one hand only, because the distance between it and the closest "Shift" key is strictly larger than x. In this case he will have to use his other hand. Having typed the symbol, Vasya returns other hand back to the chips.You are given Vasya's keyboard and the text. Count the minimum number of times Vasya will have to use the other hand.

The first line contains three integers n, m, x (1 ≤ n, m ≤ 30, 1 ≤ x ≤ 50). Next n lines contain descriptions of all the keyboard keys. Each line contains the descriptions of exactly m keys, without spaces. The letter keys are marked with the corresponding lowercase letters. The "Shift" keys are marked with the "S" symbol.  Then follow the length of the text q (1 ≤ q ≤ 5·105). The last line contains the text T, which consists of q symbols, which are uppercase and lowercase Latin letters.

If Vasya can type the text, then print the minimum number of times he will have to use his other hand. Otherwise, print "-1" (without the quotes).

3 9 4
qwertyuio
asdfghjkl
SzxcvbnmS
35
TheQuIcKbRoWnFOXjummsovertHeLazYDOG

NoteIn the first sample the symbol "A" is impossible to print as there's no "Shift" key on the keyboard.In the second sample the symbol "e" is impossible to print as there's no such key on the keyboard.In the fourth sample the symbols "T", "G" are impossible to print with one hand. The other letters that are on the keyboard can be printed. Those symbols come up in the text twice, thus, the answer is 2.

var getVals =  function() {return readline().split(' '); };

var getNums = function() {
	return readline().split(' ').map(function(a) {return parseInt(a)});
};

//11-15

var inp = getNums();
var n = inp[0];
var m = inp[1];
var x = inp[2];

var shifts = [];
var keys = {};
var keysArr = [];
var i, j;
var num;

//Get shifts and keysArr
for(i = 0; i < n; i++) {
	var str = readline();
	for (j = 0; j < m; j++) {
		var key = str[j];
		if (key === 'S') {
			shifts.push({x:i, y:j});
		} else {
			keysArr.push({x:i, y:j, k: key})
		}
	}
}

//Get n and string
var finalN = parseInt(readline());
var finalStr = readline();

function getDistance(x1, y1, x2, y2) {
	return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
}

//get keys object
keysArr.forEach(function (key) {
	var minS;
	if (shifts.length) {
		minS = getDistance(key.x, key.y, shifts[0].x, shifts[0].y);
		shifts.forEach(function (shift) {
			minS = Math.min(minS, getDistance(key.x, key.y, shift.x, shift.y));
		})
	} else {
		minS = -1;
	}
	if (keys[key.k]) {
		keys[key.k] = Math.min(minS, keys[key.k]);
	} else {
		keys[key.k] = minS;
	}
});

//get function final text
function res() {
	var shiftCount = 0;
	for(var z = 0; z < finalN; z++) {
		var finalK = finalStr[z];
		if (finalK === finalK.toLocaleLowerCase()) {
			if (!keys[finalK]) {
				return -1;
			}
		} else {
			finalK = finalK.toLocaleLowerCase();
			if (!keys[finalK]) {
				return -1;
			} else {
				if (keys[finalK] === -1) {
					return -1;
				} else {
					if (keys[finalK] > x) {
						shiftCount++;
					}
				}
			}
		}
	}
	return shiftCount;
}

print(res());

'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const ils = ipt.split(EOL).slice(0, -1)
  const [n, m, x] = ils.shift().split(' ').map(v => parseInt(v))
  const X = x * x
  const T = ils.pop()
  ils.pop()
  const K = []
  const L = {}
  const D = {}
  const S = []
  for (let i = 0; i < ils.length; i++) {
    K[i] = ils[i].split('')
  }
  for (let i = 0; i < n; i++) {
    for (let j = 0; j < m; j++) {
      let l = K[i][j]
      if (l == 'S') S.push([i, j])
      else {
        L[l] = L[l] || []
        L[l].push([i, j])
        D[l] = false
      }
    }
  }
  for (let l in L) {
    let C = L[l]
    for (let j = 0; j < C.length; j++) {
      const [lx, ly] = C[j]

      D[l] = D[l] || S.some(s => Math.pow(s[0] - lx, 2) + Math.pow(s[1] - ly, 2) <= X)
    }
  }

  let count = 0
  let isS = S.length > 0
  for (let i = 0; i < T.length; i++) {
    let l = T[i]
    if (l in L) continue
    l = l.toLowerCase()
    if (l in L && isS) count += !D[l]
    else return console.log(-1)
  }
  console.log(count)
})

var getVals =  function() {return readline().split(' '); };

var getNums = function() {
	return readline().split(' ').map(function(a) {return parseInt(a)});
};

//11-15

var inp = getNums();
var n = inp[0];
var m = inp[1];
var x = inp[2];

var shifts = [];
var keys = {};
var keysArr = [];
var i, j;
var num;

//Get shifts and keysArr
for(i = 0; i < n; i++) {
	var str = readline();
	for (j = 0; j < m; j++) {
		var key = str[j];
		if (key === 'S') {
			shifts.push({x:i, y:j});
		} else {
			keysArr.push({x:i, y:j, k: key})
		}
	}
}

//Get n and string
var finalN = parseInt(readline());
var finalStr = readline();

function getDistance(x1, y1, x2, y2) {
	return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
}

//get keys object
keysArr.forEach(function (key) {
	var minS;
	if (shifts.length) {
		minS = getDistance(key.x, key.y, shifts[0].x, shifts[0].y);
		shifts.forEach(function (shift) {
			minS = Math.min(minS, getDistance(key.x, key.y, shift.x, shift.y));
		})
	} else {
		minS = -1;
	}
	keys[key.k] = minS;
});

//get function final text
function res() {
	var shiftCount = 0;
	for(var z = 0; z < finalN; z++) {
		var finalK = finalStr[z];
		if (finalK === finalK.toLocaleLowerCase()) {
			if (!keys[finalK]) {
				return -1;
			}
		} else {
			finalK = finalK.toLocaleLowerCase();
			if (!keys[finalK]) {
				return -1;
			} else {
				if (keys[finalK] === -1) {
					return -1;
				} else {
					if (keys[finalK] > x) {
						shiftCount++;
					}
				}
			}
		}
	}
	return shiftCount;
}

print(res());

'use strict'

const {EOL} = require('os')

let ipt = ''
process.stdin.on('data', s => ipt += s)
process.stdin.on('end', () => {
  const ils = ipt.split(EOL).slice(0, -1)
  const [n, m, x] = ils.shift().split(' ').map(v => parseInt(v))
  const X = x * x
  const T = ils.pop()
  ils.pop()
  const K = []
  const L = {}
  const D = {}
  const S = []
  for (let i = 0; i < ils.length; i++) {
    K[i] = ils[i].split('')
  }
  for (let i = 0; i < n; i++) {
    for (let j = 0; j < m; j++) {
      let l = K[i][j]
      if (l == 'S') S.push([i, j])
      else {
        L[l] = L[l] || []
        L[l].push([i, j])
        D[l] = false
      }
    }
  }
  for (let l in L) {
    let C = L[l]
    for (let j = 0; j < C.length; j++) {
      const [lx, ly] = C[j]

      D[l] = S.some(s => Math.pow(s[0] - lx, 2) + Math.pow(s[1] - ly, 2) <= X)
    }
  }

  let count = 0
  let isS = S.length > 0
  for (let i = 0; i < T.length; i++) {
    let l = T[i]
    if (l in L) continue
    l = l.toLowerCase()
    if (l in L && isS) count += !D[l]
    else return console.log(-1)
  }
  console.log(count)
})


You are standing at the point $$$0$$$ on a coordinate line. Your goal is to reach the point $$$n$$$. In one minute, you can move by $$$2$$$ or by $$$3$$$ to the left or to the right (i. e., if your current coordinate is $$$x$$$, it can become $$$x-3$$$, $$$x-2$$$, $$$x+2$$$ or $$$x+3$$$). Note that the new coordinate can become negative.Your task is to find the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$.You have to answer $$$t$$$ independent test cases.

The first line of the input contains one integer $$$t$$$ ($$$1 \le t \le 10^4$$$) — the number of test cases. Then $$$t$$$ lines describing the test cases follow. The $$$i$$$-th of these lines contains one integer $$$n$$$ ($$$1 \le n \le 10^9$$$) — the goal of the $$$i$$$-th test case.

For each test case, print one integer — the minimum number of minutes required to get from the point $$$0$$$ to the point $$$n$$$ for the corresponding test case.

process.stdin.resume()
process.stdin.setEncoding('utf-8')

let currentLine = 0
let inputString = ''

process.stdin.on('data', (raw_data) => {
  inputString += raw_data
})

process.stdin.on('end', (_) => {
  inputString = inputString
    .trim()
    .split('\n')
    .map((line) => {
      return line.trim()
    })
  main()
})

function readInt() {
  return inputString[currentLine++]
}

function readString() {
  return inputString[currentLine++]
}

function readArrayInt() {
  return inputString[currentLine++].split(' ').map(Number)
}

function readArray() {
  return inputString[currentLine++].split(' ')
}

function solve() {
  const T = readInt()
  for (let i = 0; i < T; ++i) {
    let n = readInt()

      let ans = 0
      if(n % 3 === 0){
          console.log(n / 3)
      } else if (n == 1){
          console.log(2)
      } else if(n == 2){
          console.log(1)
      } else{
          while(n % 3 !== 0){
              n-=2
              ans+=1
          }
          console.log(ans + n / 3)
      }
  }
}

function main() {
  solve()
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });
    main();
});

function readline() {
    return inputString[currentLine++];
}

function main() {
    let t=readline()
    while(t-->0){
        let n=parseInt(readline())
        let mod=n%3;
        if(n==1){
            console.log(2)
            continue
        }
        switch(mod){
            case 0:
                console.log(n/3)
                break
            case 1:
            case 2:
                console.log(Math.floor(n/3)+1)
                break
        }
    }
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        const n = parseInt(readline(), 10);
        const modMap = {
            '0': 0,
            '1': 2,
            '2': 1,
            '3': 1,
            '4': 2,
            '5': 2
        };
        let six = Math.floor(n/6);
        let mod = modMap[n%6];
        let one = ((six * 2) + mod);
        let two = Infinity;
        if (n > 3) {
            let six2 = Math.floor((n-3)/6);
            let mod2 = modMap[(n-3)%6];
            two = ((six2 * 2) + mod2) + 1;
        }
        output(Math.min(one, two));
    }
}

let stop = '';
process.stdin.on('data', c => stop += c);
process.stdin.on('end', () => {
    const {EOL} = require('os');
    const lines = stop.split(EOL);
    var t = lines[0];
    for(i = 1; i <= t; i++){
        var n = lines[i];
        if(n == 1){
            console.log(2);
        }else if(n % 3 === 0){
            console.log(n / 3);
        }else{
            console.log(Math.floor(n / 3) + 1);
        }
    }
});

//Don't have to see. start------------------------------------------
var read = require('readline').createInterface({
	input: process.stdin, output: process.stdout
});
var obj; var inLine = []; var outputList = [];var retcode = new Set();
read.on('line', function(input){
	var tmp = input.split(' ');
	for(var i = 0; i < tmp.length; i++){
		inLine.push(tmp[i]);
		if(i == tmp.length - 1){
			retcode.add(inLine.length);
		}
	}
});
read.on('close', function(){
	obj = init(inLine);
	console.error('\n↑入力 ↓出力');
	Main();
	console.log(myconv(outputList, 9));
});
function makeClone(obj){return (obj instanceof Set) ? new Set(Array.from(obj)) : JSON.parse(JSON.stringify(obj));}
function nextArray(size, code){
	var ret = new Array(size);
	for(var i = 0; i < size; i++){
		if(code == 'int'){
			ret[i] = nextInt();
		}else if(code == 'long'){
			ret[i] = nextLong();
		}else if(code == 'double'){
			ret[i] = nextDouble();
		}else{
			ret[i] = next();
		}
	}
	return ret;
}
function nextIntArray(size){return nextArray(size, 'int');} function nextStrArray(size){return nextArray(size, 'str');} function nextLongArray(size){return nextArray(size, 'long');} function nextDoubleArray(size){return nextArray(size, 'double');}
function nextCharArray(){return myconv(next(),6);}
function next(){return obj.next();} function hasNext(){return obj.hasNext();} function nextInt(){return myconv(next(),1);} function nextLong(){return BigInt(next());} function nextDouble(){return parseFloat(next());}
function getCountMap(list){
	var map = {};
	for(var i = 0; i < list.length; i++){
		if(map[list[i]] == null){
			map[list[i]] = 0;
		}
		map[list[i]]++;
	}
	return map;
}
function init(input){
	return {
		list : input, index : 0, max : input.length,
		hasNext : function(){return (this.index < this.max);},
		next : function(){if(this.hasNext()){return this.list[this.index++];}else{throw 'ArrayIndexOutOfBoundsException ‚There is no more input';}},
		isReturn : function(){return retcode.has(this.index);}
	};
}
function myout(s){outputList.push(s);}
function myerr(s){console.error('debug:' + require('util').inspect(s,false,null));}
function isReturn(){return obj.isReturn();}
//param "no" is
//unknown or outlier : return i. 1: parseInt.
//2: split space. 4: split space and parseInt.
//6: split 1 character. 7: split 1 character and parseInt.
//8: join space. 9: join nextline. 0: join no character.
function myconv(i,no){try{switch(no){case 1:return parseInt(i);case 2:return i.split(' ');case 4:return i.split(' ').map(Number);case 6:return i.split('');case 7:return i.split('').map(Number);case 8:return i.join(' ');case 9:return i.join('\n');case 0:return i.join('');default:return i;}}catch(e){return i;}}

//Don't have to see. end------------------------------------------
function Main(){
	var t = nextInt();
	while(hasNext()){
		var N = nextInt();
		if(N == 1){
			myout(2);
		}else{
			myout(Math.ceil(N / 3));
		}
	}
}

process.stdin.resume();
process.stdin.setEncoding('utf-8');
let inputString = '', currentLine = 0;
process.stdin.on('data', inputStdin => { inputString += inputStdin; });
process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => string.trim());
    main();
});
function readLine() {
    return inputString[currentLine++];
}

function main() {
    const t = +readLine();
    for(let i = 0; i < t; i++){
        const n = +readLine();
        // const arr = readLine().split(' ').map(p => +p);
        let result = myFunc(n);
        console.log(result);
    }
}

function myFunc(n){
    if(n == 1) return 2;

    if(n % 3 == 0) return n/3;
    else return parseInt(n/3)+1

}

t = readline()
while(t--) {
    n = readline();
    if(n==1) {
        print(2);
        continue;
    }
    else if(n===2 || n===3) {
        print(1);
         continue;
    }
    var ans = n/3;
    if(n%3)ans++;
    print(Math.trunc(ans));

}

var t = readline();
for(var  i = 0 ; i < t ; i++){
    var n = readline();
    if(n == 1){
        print(2);
    }
    else if(n % 3 !== 0){
    print(parseInt(n / 3) + 1) ;
    }
    else{
        print((n / 3));
    }
}

var limit = parseInt(readline());
for (var i = 0; i < limit; i++)
{
    var value = parseInt(readline());
    var count = 0;
    if (value % 3 === 0)
    {
        count = value / 3;
    }
    else if (value % 3 === 2)
    {
        value -= 2;
        count++;
        count += (value / 3);
    }
    else
    {
        value -= 2;
        count = 2;
        if (value > 0)
        {
            value -= 2;
            count += (value / 3);
        }
    }
    print(count);
}

var t = +readline()

for (var i=0; i<t; i++) {

    var n = readline()
    var ans = 0
    if (n == 1) ans = 2
    if (n == 2) ans = 1
    if (n > 2) ans = Math.ceil(n/3)
    print(ans)
}

T=readline()
while(T--){
    n=readline()
    if(n==1) print(2)
    else print(parseInt((n-1)/3)+1)
}

var n;
    var thr, mod;

    var tests = parseInt(readline());
    for (var t=0; t<tests;t++) {
        n = parseInt(readline());
        if (n == 1) {
            print(2);
            continue;
        }
        thr = Math.floor(n / 3);
        mod = n % 3;
        var ans;
        if (mod == 2) {
            ans = thr + 1;
        } else if (mod == 0) {
            ans = thr;
        } else {
            ans = thr + 1;
        }
        print(ans);
    }

process.stdin.resume()
process.stdin.setEncoding('utf-8')

let currentLine = 0
let inputString = ''

process.stdin.on('data', (raw_data) => {
  inputString += raw_data
})

process.stdin.on('end', (_) => {
  inputString = inputString
    .trim()
    .split('\n')
    .map((line) => {
      return line.trim()
    })
  main()
})

function readInt() {
  return inputString[currentLine++]
}

function readString() {
  return inputString[currentLine++]
}

function readArrayInt() {
  return inputString[currentLine++].split(' ').map(Number)
}

function readArray() {
  return inputString[currentLine++].split(' ')
}

function solve() {
  const T = readInt()
  for (let i = 0; i < T; ++i) {
    let n = readInt()

      let ans = 0
      if(n % 3 === 0){
          console.log(n / 3)
      } else{
          while(n % 3 !== 0){
              n-=2
              ans+=1
          }
          console.log(ans + n / 3)
      }
  }
}

function main() {
  solve()
}

process.stdin.resume()
process.stdin.setEncoding('utf-8')

let currentLine = 0
let inputString = ''

process.stdin.on('data', (raw_data) => {
  inputString += raw_data
})

process.stdin.on('end', (_) => {
  inputString = inputString
    .trim()
    .split('\n')
    .map((line) => {
      return line.trim()
    })
  main()
})

function readInt() {
  return inputString[currentLine++]
}

function readString() {
  return inputString[currentLine++]
}

function readArrayInt() {
  return inputString[currentLine++].split(' ').map(Number)
}

function readArray() {
  return inputString[currentLine++].split(' ')
}

function solve() {
  const T = readInt()
  for (let i = 0; i < T; ++i) {
    let n = readInt()

      let ans = 0
      if(n % 3 === 0){
          console.log(n / 3)
      } else{
          while(n % 3 !== 0){
              n-=2
              ans+=1
          }
          console.log(ans)
      }
  }
}

function main() {
  solve()
}

'use strict';

process.stdin.resume();
process.stdin.setEncoding('utf-8');

let inputString = '';
let currentLine = 0;

process.stdin.on('data', inputStdin => {
    inputString += inputStdin;
});

process.stdin.on('end', _ => {
    inputString = inputString.trim().split('\n').map(string => {
        return string.trim();
    });

    main();
});

function readline() {
    return inputString[currentLine++];
}

function output(x) {
    if (typeof x !== 'string') {
        x = x.toString();
    }
    //process.stdout.write(x);   // without auto '\n' (newline)
    console.log(x);  // with auto '\n' (newline)
}

function main() {
    let N = readline();

    for (let test = 0; test < N; test++) {
        const n = parseInt(readline(), 10);
        const modMap = {
            '0': 0,
            '1': 2,
            '2': 1,
            '3': 1,
            '4': 2,
            '5': 2
        };
        let six = Math.floor(n/6);
        let mod = modMap[n%6];
        output(((six * 2) + mod));
    }
}

t = readline()
while(t--) {
    n = readline();
    if(n==1) {
        print(2);
        continue;
    }
    else if(n===2 || n===3) {
        print(1);
         continue;
    }
    var ans = n/3;
    if(n%3)ans++;
    print(ans);

}

var t = readline();
for(var  i = 0 ; i < t ; i++){
    var n = readline();
    if(n % 3 === 0){
    print(n / 3);
    }
    else if(n % 3 == 1){
        print(parseInt(n / 3) + 2);
    }
    else if(n % 3 == 2){
        print(parseInt(n / 3) + 1);
    }
}

var t = readline();
for(var  i = 0 ; i < t ; i++){
    var n = readline();
    if(n % 3 === 0){
    print(n / 3);
    }
    else if(n % 2 === 0){
        print(n / 2);
    }
    else if(n % 3 == 1){
        print(parseInt(n / 3) + 2);
    }
    else if(n % 3 == 2){
        print(parseInt(n / 3) + 1);
    }
}


There are $$$n$$$ students numerated from $$$1$$$ to $$$n$$$. The level of the $$$i$$$-th student is $$$a_i$$$. You need to split the students into stable groups. A group of students is called stable, if in the sorted array of their levels no two neighboring elements differ by more than $$$x$$$.For example, if $$$x = 4$$$, then the group with levels $$$[1, 10, 8, 4, 4]$$$ is stable (because $$$4 - 1 \le x$$$, $$$4 - 4 \le x$$$, $$$8 - 4 \le x$$$, $$$10 - 8 \le x$$$), while the group with levels $$$[2, 10, 10, 7]$$$ is not stable ($$$7 - 2 = 5 > x$$$).Apart from the $$$n$$$ given students, teachers can invite at most $$$k$$$ additional students with arbitrary levels (at teachers' choice). Find the minimum number of stable groups teachers can form from all students (including the newly invited).For example, if there are two students with levels $$$1$$$ and $$$5$$$; $$$x = 2$$$; and $$$k \ge 1$$$, then you can invite a new student with level $$$3$$$ and put all the students in one stable group.

The first line contains three integers $$$n$$$, $$$k$$$, $$$x$$$ ($$$1 \le n \le 200\,000$$$, $$$0 \le k \le 10^{18}$$$, $$$1 \le x \le 10^{18}$$$) — the initial number of students, the number of students you can additionally invite, and the maximum allowed level difference. The second line contains $$$n$$$ integers $$$a_1, a_2, \dots, a_n$$$ ($$$1 \le a_i \le 10^{18}$$$) — the students levels.

In the only line print a single integer: the minimum number of stable groups you can split the students into.

NoteIn the first example you can invite two students with levels $$$2$$$ and $$$11$$$. Then you can split the students into two stable groups:   $$$[1, 1, 2, 5, 8, 11, 12, 13]$$$,  $$$[20, 22]$$$. In the second example you are not allowed to invite new students, so you need $$$3$$$ groups:   $$$[1, 1, 5, 5, 20, 20]$$$  $$$[60, 70, 70, 70, 80, 90]$$$  $$$[420]$$$

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = 1;
  while (t--) {
    let [n, k, x] = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    n = Number(n);
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    arr.sort((a, b) => {
      if (a <= b) return -1;
      else return 1;
    });
    let dif = [],
      cnt = 1;
    for (let i = 0; i < n - 1; i++) {
      if (arr[i + 1] - arr[i] > x) {
        dif.push(arr[i + 1] - arr[i]);
        cnt++;
      }
    }
    if (dif.length) {
      dif.sort((a, b) => {
        if (a <= b) return -1;
        else return 1;
      });
      for (let i = 0; i < dif.length; i++) {
        let j = dif[i] % x === 0n ? dif[i] / x - 1n : dif[i] / x;
        if (j > k) break;
        else {
          cnt--;
          k -= j;
        }
      }
      console.log(cnt);
    } else console.log(cnt);
  }
};
solve();

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => BigInt(x));

function main () {
	let [n, k, x] = rna();
	n = Number(n);
	const a = rna();

	//a.sort((x, y) => x - y);
	a.sort((a ,b) => {
			if(a > b) {
			return 1;
			} else if (a < b){
			return -1;
			} else {
			return 0;
			}
			});

	const d = [];
	for (let i = 0; i < n - 1; i++) {
		if (a[i+1] - a[i] > x) {
			d.push(a[i+1] - a[i]);
		}
	}

	d.sort((a ,b) => {
			if(a > b) {
			return 1;
			} else if (a < b){
			return -1;
			} else {
			return 0;
			}
			});

	let ans = d.length + 1;
	for (const df of d) {
		k -= (df-1n)/x;
		if (k >= 0) ans--;
	}

	console.log(ans);
}

// --------------- PRE-DEFINED START ---------------
const rl = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const nextLine = () => {
  const nextLineGen = (async function* () {
    for await (const line of rl) {
      yield line.trim();
    }
  }());
  return (async () => {
    const next = await nextLineGen.next();
    return next.value;
  })();
};

const nextNum = async () => {
  const line = await nextLine();
  return Number(line);
};

const nextNumArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => Number(num));
};

const nextBigIntArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => BigInt(num));
};

function sortAsc(a, b) {
   if (a < b) return -1;
   if (a > b) return 1;
   return 0;
}
// --------------- PRE-DEFINED END ---------------

const main = async () => {
  let [n, k, x] = await nextBigIntArr();
  let arr = await nextBigIntArr();

  let gaps = [];

  arr.sort(sortAsc);
  for (let i = 1; i < n; i++) {
    const tmp = arr[i] - arr[i-1];
    if (tmp > x) gaps.push((tmp / x) - (tmp % x === 0n ? 1n : 0n));
  }

  gaps.sort(sortAsc);
  let res = gaps.length + 1;
  for (let i = 0; i < gaps.length; i++) {
    if (gaps[i] > k) break;
    k -= gaps[i];
    res -= 1;
  }

  console.log(res);
};

main();

const lib = require('readline');
const rl = lib.createInterface({
    input: process.stdin,
    output: process.stdout
});

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => ((await getLineGen.next()).value);
})();

let solve = async () => {
    let strn, strk, strx;
    let n, k, x;
    [n, k, x] = (await getLine()).split(' ').map(num => parseInt(num));
    const a = (await getLine()).split(' ').map(num => parseInt(num));
    let bigcmp = function(a,b) {
        const zero = BigInt(0);
        const diff = a-b;
        if (diff < zero)
            return -1;
        else if (diff > zero)
            return 1;
        else return 0;
    }
    a.sort((a,b) => (a-b));
    const diffs = [];
    for(let i = 1; i < n; i++) {
       if (a[i] - a[i-1] > x) {
           diffs.push(a[i]-a[i-1]);
       }
    }
    diffs.sort((a,b)=>(a-b));
    let i;
    for(i = 0; i<diffs.length && k > 0; i++) {
        let need = Math.floor((diffs[i] - 1) / x);
       if (need > k)
           break;
       else
           k -= need;
    }
    console.log(diffs.length - i + 1);
}

solve();

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0;
    var [n, k, x] = lines[l++].split(' ').map(BigInt);
    var arr = lines[l++].split(' ').map(BigInt);
    console.log(solve(n, k, x, arr))
});

function solve(n, k, x, arr) {
    const cp = (a, b) => {
        if (a < b) {
            return -1
        } else if (a > b) {
            return 1
        } else {
            return 0
        }
    }
    arr.sort(cp)

    const needs = []
    arr.forEach((item, i) => {
        if (i && item - arr[i - 1] > x) {
            const need = ceil((item - arr[i - 1]), x) - 1n
            needs.push(need)
        }
    })
    needs.sort(cp)

    let sum = 0n
    for (let i = 0; i < needs.length; i++) {
        if (sum + needs[i] > k) {
            return needs.length - i + 1
        }
        sum += needs[i]
    }
    return 1
}

function ceil(a, b) {
    const r = a % b
    return r ? (a - r) / b + 1n : a / b
}

function gcd(x, y) {
   if (y === 0) {
      return x;
   }
   return gcd(y, x % y);
}

function div(a, b) {
   return Math.floor(a / b);
}

function solve() {
   var nkx = readArray(BigInt);
   var n = Number(nkx[0]);
   var k = nkx[1];
   var x = nkx[2];
   var a = readArray(BigInt);
   a.sort(sortF);
   var ans = 1;
   var arr = [];
   for (var i = 1; i < n; i++) {
      var diff = a[i] - a[i - 1];
      if (diff > x) {
         ans++;
         arr.push((diff / x) - (diff % x === 0n ? 1n : 0n));
      }
   }
   arr.sort(sortF);
   for (var i = 0; i < arr.length; i++) {
      if (arr[i] > k) {
         break;
      }
      k -= arr[i];
      ans--;
   }
   write(ans);
}

function init() {
   var T;
   T = 1;
   //T = Number(read());
   for (var t = 0; t < T; t++) {
      solve();
   }
}

function sortF(a, b) {
   if (a < b) {
      return -1;
   }
   if (a > b) {
      return 1;
   }
   return 0;
}

function readArray(f) {
   return read().split(' ').map(f);
}

var isNode = typeof console !== 'undefined';
var MEMORY = [];
var MEMORY_INDEX = 0;
if (isNode) {
   var fs = require('fs');
   var path = require('path');

   var inTextName;
   var outTextName;

   var needWriteFile = false;

   var writeResult = '';
   if (process.argv.length === 5) {
      inTextName = process.argv[3];
      outTextName = process.argv[4];
   }

   if (inTextName) {
      fs.readFile(path.join(__dirname, inTextName), 'utf8', (err, data) => {
         MEMORY = data.split('\r\n');
         init();
         if (needWriteFile) {
            fs.writeFile(path.join(__dirname, outTextName), writeResult, (err) => {
               err ? console.error(err) : console.log('good')
            });
         }
      });
   } else {
      MEMORY = fs.readFileSync(0, 'utf-8').split('\r\n');
      init();
   }
} else {
   init();
}

function write(value) {
   if (needWriteFile) {
      writeResult += value + '\n';
      return;
   }
   isNode ? console.log('' + value) : print('' + value);
}
function read() {
   return isNode ? MEMORY[MEMORY_INDEX++] : readline();
}
function readAll() {
   return isNode && MEMORY;
}

"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || function (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const fs = __importStar(require("fs"));
// import * as readline from 'readline'
// const rl = readline.createInterface({ input: process.stdin, output: process.stdout })
// const ask = (query: string) => new Promise<string>((resolve) => rl.question(query, resolve))
// // Don't forget `rl.close()`.
const INT = Math.floor;
Array.prototype.last = function () {
    return this.length === 0 ? undefined : this[this.length - 1];
};
Array.prototype.isEmpty = function () {
    return this.length === 0;
};
const less = (a, b) => (a == b ? 0 : a < b ? -1 : 1);
const greater = (a, b) => (a == b ? 0 : a < b ? 1 : -1);
const bigIntMax = (...args) => args.reduce((m, e) => (e > m ? e : m));
const bigIntMin = (...args) => args.reduce((m, e) => (e < m ? e : m));
const bigIntAbs = (arg) => (arg < 0 ? -arg : arg);
function read_stdin() {
    return fs.readFileSync(process.env.NODE_ENV === 'debug' ? stdin : process.stdin.fd, 'utf8');
}
class Input {
    constructor(str) {
        this.index = 0;
        this.inputs = (str ? str : read_stdin()).split(/\s+/);
    }
    number() {
        return Number(this.inputs[this.index++]);
    }
    numbers(n) {
        return this.inputs.slice(this.index, (this.index += n)).map(Number);
    }
    bigint() {
        return BigInt(this.inputs[this.index++]);
    }
    bigints(n) {
        return this.inputs.slice(this.index, (this.index += n)).map(BigInt);
    }
    word() {
        return this.inputs[this.index++];
    }
    words(n) {
        return this.inputs.slice(this.index, (this.index += n));
    }
}
function array(len, init) {
    return Array(len).fill(init);
}
function array2(h, w, init) {
    return array(h, 0).map(() => array(w, init));
}
function main() {
    const input = new Input();
    const N = input.number();
    const K = input.bigint();
    const X = input.bigint();
    const A = input.bigints(N);
    A.sort(less);
    let count = 1;
    const spans = [];
    for (let i = 1; i < N; i++) {
        if (A[i] - A[i - 1] > X) {
            count++;
            spans.push((A[i] - 1n - A[i - 1]) / X);
        }
    }
    spans.sort(less);
    let k = K;
    for (let i = 0; i < spans.length; i++) {
        if (k === 0n)
            break;
        const span = spans[i];
        if (span > k)
            break;
        count--;
        k -= span;
    }
    console.log(count);
}
main();
//# sourceMappingURL=aoj.js.map

nkx = readline().split(' ');
n = +nkx[0];
k = +nkx[1];
x = +nkx[2];

a = readline().split(' ').map(x => +x);
a.sort((o, p) => o - p);

gF = [];
gL = [];

lastF = a[0];
lastL = a[0];

for (i = 1; i < n; ++i) {
  if (a[i] - a[i - 1] <= x) {
    lastL = a[i];
  } else {
    gF.push(lastF);
    gL.push(lastL);

    lastF = a[i];
    lastL = a[i];
  }
}

gF.push(lastF);
gL.push(lastL);

distances = [];

for (i = 1; i < gF.length; ++i) {
  distances.push(gF[i] - gL[i - 1]);
}

distances.sort((o, p) => o - p);

res = gF.length;

for (i = 0; i < distances.length; ++i) {
  dist = Math.ceil(distances[i] / x) - 1;

  if (dist <= k) {
    k -= dist;
    res -= 1;
  }
}

print(res);

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = 1;
  while (t--) {
    let [n, k, x] = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    n = Number(n);
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    arr.sort((a, b) => {
      if (a <= b) return -1;
      else return 1;
    });
    let dif = [],
      cnt = 1;
    for (let i = 0; i < n - 1; i++) {
      if (arr[i + 1] - arr[i] > x) {
        let j = arr[i + 1] - arr[i];
        if (j <= (k + 1n) * k) dif.push(j);
        cnt++;
      }
    }
    if (dif.length) {
      dif.sort((a, b) => {
        if (a <= b) return -1;
        else return 1;
      });
      for (let i = 0; i < dif.length; i++) {
        let j = dif[i] % x === 0n ? dif[i] / x - 1n : dif[i] / x;
        if (j > k) break;
        else {
          cnt--;
          k -= j;
        }
      }
      console.log(cnt);
    } else console.log(cnt);
  }
};
solve();

"use strict";
const fs = require("fs");
//let filename = "0.txt";
let filename = 0;
const input = fs.readFileSync(filename, "utf8").trim().split("\n");
let line = 0;
function readline() {
  return input[line++];
}
const solve = () => {
  let t = 1;
  while (t--) {
    let [n, k, x] = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    let arr = readline()
      .trim()
      .split(" ")
      .map((cur) => BigInt(cur));
    arr.sort((a, b) => {
      if (a - b <= 0n) return -1;
      else return 1;
    });
    let dif = [],
      cnt = 1;
    for (let i = 0n; i < n - 1n; i++) {
      if (arr[i + 1n] - arr[i] > x) {
        cnt++;
        dif.push(arr[i + 1n] - arr[i]);
      }
    }
    if (dif.length) {
      dif.sort((a, b) => {
        if (a - b <= 0n) return -1;
        else return 1;
      });
      for (let i = 0; i < dif.length; i++) {
        let j = dif[i] % x === 0 ? dif[i] / x - 1n : dif[i] / x;
        if (j > k) break;
        else {
          cnt--;
          k -= j;
        }
      }
      console.log(cnt);
    } else console.log(cnt);
  }
};
solve();

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, k, x] = rna();
	const a = rna();

	a.sort((x, y) => x - y);

	const d = [];
	for (let i = 0; i < n - 1; i++) {
		if (a[i+1] - a[i] > x) {
			d.push(a[i+1] - a[i]);
		}
	}

	d.sort((x, y) =>  x - y);

	let ans = d.length + 1;
	for (const df of d) {
		k -= Math.floor((df-1)/x);
		if (k >= 0) ans--;
	}

	console.log(ans);
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, k, x] = rna();
	const a = rna();

	a.sort((x, y) => x - y);

	const d = [];
	for (let i = 0; i < n - 1; i++) {
		if (a[i+1] - a[i] > x) {
			d.push(a[i+1] - a[i]);
		}
	}

	d.sort((x, y) =>  x - y);

	let ans = d.length + 1;
	for (const df of d) {
		k -= Math.floor(df/(x+1));
		if (k >= 0) ans--;
	}

	console.log(ans);
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, k, x] = rna();
	let a = rna();

	a.sort((x, y) => x - y);

	let d = [];
	for (let i = 0; i < n - 1; i++)
		d[i] = a[i + 1] - a[i];

	d.sort((x, y) => x - y);

	let ans = 1, klft = k;
	for (let i = 0; i < d.length; i++) {
		if (d[i] > x) {
			const req = Math.floor((d[i] - 1)/ x);
			if (klft >= req) klft -= req;
			else ans++;
			//console.log('i', i, d[i], x, 'req',req,'klft',klft,'ans',ans)
		}
	}
	console.log(ans);
}

var dataitr;
var stdin_input = "";
process.stdin.resume();
process.stdin.setEncoding("ascii");
process.stdin.on("data", function (input) { stdin_input += input; });
process.stdin.on("end", function () { dataitr = stdin_input.split('\n').values(); main(); });

const rl = () => dataitr.next().value.trim();
const rn = () => Number(rl());
const ra = () => rl().split(' ');
const rna = () => ra().map(x => Number(x));

function main () {
	let [n, k, x] = rna();
	let a = rna();

	a.sort((x, y) => x - y);

	let d = [];
	for (let i = 0; i < n - 1; i++)
		d[i] = a[i + 1] - a[i];

	d.sort((x, y) => x - y);

	let ans = 1, klft = k;
	for (let i = 0; i < d.length; i++) {
		if (d[i] > x) {
			const req = Math.floor(d[i] / x);
			if (klft >= req) klft -= req;
			else ans++;
		}
	}
	console.log(ans);
}

// --------------- PRE-DEFINED START ---------------
const rl = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const nextLine = () => {
  const nextLineGen = (async function* () {
    for await (const line of rl) {
      yield line.trim();
    }
  }());
  return (async () => {
    const next = await nextLineGen.next();
    return next.value;
  })();
};

const nextNum = async () => {
  const line = await nextLine();
  return Number(line);
};

const nextNumArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => Number(num));
};

const nextBigIntArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => BigInt(num));
};
// --------------- PRE-DEFINED END ---------------

const main = async () => {
  let [n, k, x] = await nextBigIntArr();
  let arr = await nextBigIntArr();

  let gaps = [];

  arr.sort((a, b) => a > b);
  for (let i = 1; i < n; i++) {
    const tmp = arr[i] - arr[i-1];
    if (tmp > x) gaps.push((tmp / x) - (tmp % x === 0n ? 1n : 0n));
  }

  gaps.sort((a, b) => a > b);
  let res = gaps.length + 1;
  for (let i = 0; i < gaps.length; i++) {
    if (gaps[i] > k) break;
    k -= gaps[i];
    res -= 1;
  }

  console.log(res);
};

main();

// --------------- PRE-DEFINED START ---------------
const rl = require("readline").createInterface({
  input: process.stdin,
  output: process.stdout,
  terminal: false
});

const nextLine = () => {
  const nextLineGen = (async function* () {
    for await (const line of rl) {
      yield line.trim();
    }
  }());
  return (async () => {
    const next = await nextLineGen.next();
    return next.value;
  })();
};

const nextNum = async () => {
  const line = await nextLine();
  return Number(line);
};

const nextNumArr = async () => {
  const line = await nextLine();
  return line.split(" ").map((num) => Number(num));
};
// --------------- PRE-DEFINED END ---------------

const main = async () => {
  let [n, k, x] = await nextNumArr();
  let arr = await nextNumArr();

  let gaps = [];

  arr.sort((a, b) => a - b);
  for (let i = 1; i < n; i++) {
    const tmp = arr[i] - arr[i-1];
    if (tmp > x) gaps.push(Math.floor((tmp + x - 1) / x) - 1);
  }

  gaps.sort((a, b) => a - b);
  let res = gaps.length + 1;
  for (let i = 0; i < gaps.length; i++) {
    if (gaps[i] > k) break;
    k -= gaps[i];
    res -= 1;
  }

  console.log(res);
};

main();

const lib = require('readline');
const rl = lib.createInterface({
    input: process.stdin,
    output: process.stdout
});

const getLine = (function () {
    const getLineGen = (async function* () {
        for await (const line of rl) {
            yield line;
        }
    })();
    return async () => ((await getLineGen.next()).value);
})();

let solve = async () => {
    let strn, strk, strx;
    let n, k, x;
    [n, k, x] = (await getLine()).split(' ').map(num => parseInt(num));
    const a = (await getLine()).split(' ').map(num => parseInt(num));
    let bigcmp = function(a,b) {
        const zero = BigInt(0);
        const diff = a-b;
        if (diff < zero)
            return -1;
        else if (diff > zero)
            return 1;
        else return 0;
    }
    a.sort((a,b) => (a-b));
    const diffs = [];
    for(let i = 1; i < n; i++) {
       if (a[i] - a[i-1] > x) {
           diffs.push(a[i]-a[i-1]);
       }
    }
    diffs.sort((a,b)=>(a-b));
    let i;
    for(i = 0; i<diffs.length && k > 0; i++) {
        let need = ((diffs[i] - 1) / x);
       if (need > k)
           break;
       else
           k -= need;
    }
    console.log(diffs.length - i + 1);
}

solve();

var readline = require('readline');

var rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
});
var lines = [];
rl.on('line', function(input) {
    lines.push(input);
});
rl.on('close', function() {
    var l = 0;
    var [n, k, x] = lines[l++].split(' ').map(BigInt);
    var arr = lines[l++].split(' ').map(BigInt);
    console.log(solve(n, k, x, arr))
});

function solve(n, k, x, arr) {
    const cp = (a, b) => {
        if (a < b) {
            return -1
        } else if (a > b) {
            return 1
        } else {
            return 0
        }
    }
    arr.sort(cp)

    const needs = []
    arr.forEach((item, i) => {
        if (i && item - arr[i - 1] > x) {
            const need = ceil((item - arr[i - 1]), x) - 1n
            needs.push(need)
        }
    })
    needs.sort(cp)

    let sum = 0n
    for (let i = 0; i < needs.length; i++) {
        if (sum + needs[i] > k) {
            return needs.length - i + 1
        }
        sum += needs[i]
    }
    return 1
}

function ceil(a, b) {
    const r = a % b
    return (a - r) / b
}