Problems
Change max and min
Change max and min
Given array of n integers. Change all its maximum elements to minimum, and all its minimum elements change to maximum.
Input
First line contains number n (n ≤ 100). Next line contains n integers, each of them does not exceed 100 by absolute value.
Output
Print the updated array.
Input example #1
7 3 5 -7 7 5 -9 -4
Output example #1
3 5 -7 -9 5 7 -4