1699: 【入门】换位置

Memory Limit:16 MB Time Limit:1.000 S
Judge Style:Text Compare Creator:
Submit:3 Solved:3

Description

体育课上,有一个班级的同学站成了一队,体育老师请最高的和最矮的两位同学调换一下位置,其余的同学不要动,请编程实现!(假设所有人的高矮都是不一样的)

Input

第一行有一个整数n代表该班级的总人数(n≤100)

第二行有n个数,代表每个人的身高

Output

调换位置后的结果

Sample Input Copy

8
8 9 10 4 7 6 5 3

Sample Output Copy

8 9 3 4 7 6 5 10