function Main(input) { const data = input.split("\n"); const n = data[0]; const y = data[1].split(" "); y.sort(); let sum = 0; if(n % 2 == 1) { sum = calcSum(y, Math.floor(n/2)); } else { sum = Math.min(calcSum(y, n/2), calcSum(y, n/2-1)); } console.log(sum); } function calcSum(y, index) { let sum = 0; const base = Number(y[index]); for(let i=0; i