import java.util.*;
public class Main {
public static void main(String[] args) {
Scanner scn=new Scanner(System.in);
int n=scn.nextInt();
int [] arr=new int[n];
int max=0;
for (int i=0;i<n;i++) {
arr[i]=scn.nextInt();
if(arr[i]>max) {
max=arr[i];
}
}
int[] ans=hash_array(arr, arr.length,max);
HashMap<Integer,Integer> map=new HashMap<>();
for(int j=0;j<ans.length;j++) {
if(ans[j] !=-1) {
map.put(arr[j], j);
}
}
ArrayList<Integer> keys=new ArrayList<>(map.keySet());
Collections.sort(keys);
for(int key:keys) {
System.out.println(map.get(key));
}
}
public static int[] hash_array(int A[], int n,int MAX) {
int[] hash = new int[MAX+1];
for (int i = 0; i <= MAX; i++)
hash[i] = -1;
int count = 0;
for (int i = 0; i < n; i++)
{
if (hash[A[i]] == -1)
{
hash[A[i]] = count;
count++;
continue;
}
for (int j = 0; j < i; j++) {
if (hash[A[j]] > hash[A[i]])
hash[A[j]]--;
}
hash[A[i]] = count - 1;
}
return hash;
}
}