#include <iostream>
#include <stack>
using namespace std;
stack<int> s;
stack<int> s2;
int main(){
int n;
int arr[500000] = {0};
cin >> n;
for(int i=0;i<n-1;i++){
int temp;
cin >> temp;
s.push(temp);
}
for(int i=0;i<n;i++){
int h1 = s.top();
s.pop();
int h2 = 0;
while(h1>h2 && !s.empty()){
h2 = s.top();
s.pop();
s2.push(h2);
}
if(h1<=h2){
arr[n-1-i] = s.size()+1;
}
while(!s2.empty()){
s.push(s2.top());
s2.pop();
}
}
for(int i=0;i<n;i++){
cout << arr[i] << " ";
}
}