the question is as follows
You are given an array A containing N elements and do the following step repeatedly