Pastable version of compressing an array of integers