#include
using namespace std;
void selection_sort(int*, int);
int main(){
int n;
cin>>n;
int a[1000]={0};
for(int i=0; i<n; i++){
cin>>a[i];
}
selection_sort(a,n);
for(int i=0; i<n;i++){
cout<<a[i]<<", ";
}
return 0;
}
void selection_sort(int a[], int n){
for(int i=0; i<n-1;i++){
//find the smallest index element index in the unsorted portion
int min_index=i;
for(int j=0; j<=n-1;j++){
if(a[j]<a[min_index]){
min_index=j;
}
}
//after this loop we can do a swap finally
swap(a[i], a[min_index]);
}
}
//its not gives the sorted element, i am using codeblocks ide. please check.