function solution(board, moves) {
var answer = 0;
let basket = [];
for(let el of moves){
for(let i = 0; i < board.length; i++){
if(board[i][el - 1] > 0){
basket.push(board[i][el - 1]);
board[i][el - 1] = 0;
break;
}
}
}
let deletedArr = [0];
for(let el of basket){
if(deletedArr[deletedArr.length - 1] === el){
deletedArr.pop()
answer += 2;
continue;
}
deletedArr.push(el)
}
return answer;
}