Clone input array to preserve original order.