function main(input) { const n = Number(input[0]); const arr = input[1].split(" "); const cnt = []; let now = 0; for(let i=n-2; i>=0; i--) { if(arr[i+1] !== arr[i]) now++; else now = 1; cnt[i] = now; } console.log(arr); console.log(cnt); let ans = 0; for(let i=0; i