function main(input) { let [N] = getIntegers(input); let S = input.shift(); let A = getIntegers(input); let [Q] = getIntegers(input); let K = getIntegers(input); let dp = [A[0]]; for(let i=1; i 0) { for(let k=1; k 0) { let X = Math.floor((l + r) / 2); if(K >= DP[X]) { l = X; } else { r = X; } } return r; } //-- functions ------------------------------------ function getIntegers(lines) { return lines.shift().split(" ").map(function(e) { return Number(e); }); } function getBigIntegers(lines) { return lines.shift().split(" ").map(function(e) { return BigInt(e); }); } function getStrings(lines) { return lines.shift().split(" "); } function twoDimenArrayByValue(h, w, value) { const list = new Array(h); for(let i=0; i 0) str += " "; str += e; }); return str; }; main(require("fs").readFileSync("/dev/stdin", "utf8").trim().split("\n"));