Newb question

Hello,
how to find min no. of elements to replace to make the array ap (arithmetic progression)?

Thanks
Bill