///////////////////////////////////////////////////
/////  /////  LogName: dcshw/////  FullName: dcshw
/////  CreationDate: 2008-04-02 13:02:17
/////  
///////////////////////////////////////////////////



import java.util.*;
import java.io.*;

public class myBST {
	//your implementation here
	
	public static void main(String [] args) {
		//Parse input
		Scanner stdin = new Scanner(System.in);
		int numNodes = stdin.nextInt();
		
		//Declare array
		int[] preOrder = new int[numNodes];
		
		for(int i = 0; i < numNodes; i++)
		{
			preOrder[i] = stdin.nextInt();
		}		
		
		//Required output
		int[] output = new int[numNodes];
		countNodes(preOrder, 0, output.length-1, 0, output);
		
		for(int i = 0; i < output.length; i++)		
		{
			if(output[i] == 0) break;
			
			System.out.println(output[i]);
		}
	}
	
	public static void countNodes(int[] preOrder, int start, int end, int level, int[] output)
	{
		//Increment the level count by 1
		output[level]++;
		
		//Base case, if this subtree consists of only 1 element, then just return
		if(end == start)
		{			
			return;
		}
					
		//Get the root node of the subtree
		int root = preOrder[start];
		
		//Find the end point of the left subtree		
		int leftEnd = start+1;
		while(leftEnd <= end && preOrder[leftEnd] < root)
		{
			leftEnd++;
		}
		
		//At this point, leftEnd is EITHER pointing to the FIRST element of the right subtree
		//OR it is pointing to the end of the array + 1 (no right subtree).		
		//First we check to see if there is a LEFT subtree
		if(leftEnd != start+1 )
		{
			countNodes(preOrder, start+1, leftEnd-1, level+1, output);		
		}
		
		//Check to see if there is a right subtree
		if(leftEnd <= end)
		{
			countNodes(preOrder, leftEnd, end, level+1, output);
		}			
		
	}
	

}

