well, as this is an assignment, I won't give you any code, you have to figure it out yourself. But basically, you loop over the list, create two variables iMin and iMax for example, and for each value compare iMin and iMax to that value and assign a new variable iBuf to that one.