#include<stdio.h>
#define N 2000000

int main(){
  int n, i, j, A[N], B[N], C[N], count = 0;
  scanf("%d", &n);
  for(i = 0 ; i < n ; i++){
    scanf("%d", &A[i]);
  }
  for(i = 0 ; i < n - 1 ; i++){
      if(i == A[i]) count++;
      B[i] = count;
  }
  for(i = n ; i > 0 ; i--){
    for(j = 0 ; j < n - 1 ; j++){
      if(A[i ]== j){
	C[B[j]] = A[i];
	B[j]--;
      }
    }
  }
  for(i = 0 ; i < n ; i++){
    printf("%d", C[i]);
    if(i != n - 1) printf(" ");
    else printf("\n");
  }
}


