#include<stdio.h>
#include<string.h>
#define N 200005
struct list{
int flag,q[N],front,back;
struct list *next;
struct list *prev;
};
void clear(struct list *bt){
memset(bt->q,0,sizeof bt->q);
bt->front=1;
bt->back=0;
bt->flag=0;
bt->next=NULL;
bt->prev=NULL;
}
struct list *head=NULL;
struct list *tail=NULL;
int main(){
int n;
scanf("%d",&n);
for(int i=1;i<=n;i++){
int f;
scanf("%d",&f);
if(head==NULL){
struct list dot;
clear(&dot);
dot.q[++dot.back]=i;
dot.flag=f;
head=˙
tail=˙
}else if(f!=tail->flag){
struct list dot;
printf("%d ",&dot==tail);
clear(&dot);
dot.q[++dot.back]=i;
dot.flag=f;
dot.prev=tail;
tail->next=˙
tail=˙
}else tail->q[++tail->back]=i;
}/*
while(head->next!=NULL){
for(struct list *p=head;p!=NULL;p=p->next)
printf("%d ",p->q[p->front++]);
putchar('\n');
for(struct list *p=head;p!=NULL;p=p->next){
if(p->front>p->back){
if(p==head){
head=head->next;
head->next=NULL;
}else if(p==tail){
tail=tail->prev;
tail->next=NULL;
}else{
p->prev->next=p->next;
p->next->prev=p->prev;
}
}
}
for(struct list *p=head;p->next!=NULL;p=p->next){
if(p->flag==p->next->flag){
while(p->next->front<=p->next->back)
p->q[++p->back]=p->next->q[p->next->front++];
if(p==tail->prev){
tail=p;
tail->next=NULL;
}else{
p->next=p->next->next;
p->next->prev=p;
}
}
}
}*/
return 0;
}