Change max and min#7849

Change max and min

1 second
128 megabytes
Easy (≈1000)

Given an array of integers. Change all its maximum elements to the minimum value, and all its minimum elements to the maximum value.

Input

The first line contains the number n~(n \le 100). The next line contains integers, each of which does not exceed in absolute value.

Output

Print the updated array.

Examples

Example 1

Loading
Loading