let x = [1, 0, -1, 0] let i = require('fs').readFileSync('/dev/stdin', 'utf8').split('\n') let d = parseInt(i[0]) let a = i[1].split(' ').map((e) => parseInt(e)) for (let n = 5; n >= 3; n--) { let b = a[n] for (let m = 0; m <= 3; m++) { a[n - m] -= b * x[m] } } let o = 0 for (let n = 2; n >= 0 ; n--) { if (a[n] != 0) { o = n break } } console.log(o) console.log(a.slice(0,o+1).join(' '))