#include <iostream>
using namespace std;

int main(int argc, char** argv) {
	int n,max,i,x,t,j;
	cin >> n;
	int a[n-1];
	for(i=0;i<=n-1;i=i+1){
		cin>>a[i];
	}
	if (n==2){
		t = a[0];
		a[0]=a[1];
		a[1]=t;
	}
	else{
	i = 0;
	max=-1;
	for(i=0;i<n;i=i+1){
		for(j=i;j<n;j=j+1){
			if(a[j]>max) max = a[j];
			x=j;
		}
		if(a[i]!=max) {
			t=a[i];
			a[i]=max;
			a[x]=t;
			i=n+1;
		}
		else max=-1;
	}
	}
	for(i = 0;i<n;i=i+1){
		cout<<a[i]<<" ";
	}
	cout<<endl;
	return 0;
}