Execution time limit is 1 second

Runtime memory usage limit is 128 megabytes

Given array of n integers. Change all its maximum elements to minimum, and all its minimum elements change to maximum.

First line contains number n (n ≤ 100). Next line contains n integers, each of them does not exceed 100 by absolute value.

Print the updated array.

Input #1

Answer #1