Change max and min#7849

Change max and min

1 segundo
128 megabytes
Fácil

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

Entrada

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

Salida

Print the updated array.

Ejemplos

Ejemplo 1

Loading
Loading