function solution(n, lost, reserve) {
let answers = [];
let answer = 0;
for (let i =0; i< n; i++) {
answers.push(1);
if(lost.includes(i+1)) --answers[i];
if(reserve.includes(i+1)) ++answers[i];
}
for(let i = 0; i< n; i++) {
if(answers[i] === 0 && answers[i-1] === 2) answers[i] = answers[i-1] = 1;
if(answers[i] === 0 && answers[i+1] === 2) answers[i] = answers[i+1] = 1;
if(answers[i] !==0) answer += 1
}
return answer;
}