Бэкэнд

function runProgram(input) {
 // write your code here
 input = input.trim().split("\n");
 let N =Number(input[0]);
 let arr=input[1].trim().split(" ").map(Number);
 arr.sort();
 logic(N,arr);
}

function logic(N,arr){
 let length=2*N;
 let sum=0;
 for(let i=length/2;i<length;i++){
    sum = sum + arr[i]; 
 }
 console.log(sum);
}


if (process.env.USER === "") {
 runProgram(``);
} else {
 process.stdin.resume();
 process.stdin.setEncoding("ascii");
 let read = "";
 process.stdin.on("data", function (input) {
   read += input;
 });
 process.stdin.on("end", function () {
   read = read.replace(/\n$/, "");
   read = read.replace(/\n$/, "");
   runProgram(read);
 });
 process.on("SIGINT", function () {
   read = read.replace(/\n$/, "");
   runProgram(read);
   process.exit(0);
 });
}
Mayank Dagar