#include <stdio.h>
int main(){
    int n;
    scanf("%d",&n);
    //validation
    if(n<0){
        printf("Invalid input");
        return 0;
    }
    int stack[20],temp[20];
    int top = -1,temptop = -1;
    for(int i = 0; i<n; i++){
        scanf("%d",&stack[i]);
        top ++;
    }
    // sort the stack using another stack
    while(top != -1){
        int current = stack[top --];
        while(temptop != -1 && temp[top] > current){
            stack[++top] = temp[temptop --];
        }
        temp[++temptop] = current;
    }
    while(temptop != -1){
        stack[++top] = temp[temptop--];
    }
    //print the stack
    for(int i = top; i>= 0; i--){
    }
    return 0;
}