#include<bits/stdc++.h>
using namespace std;
int n;
int a[301234];
int color[301234];
int oppo[301234];

class SuffixArray{
public:
	static const int SIZE = 300010;
	int sa[SIZE], rank[SIZE], lcp[SIZE], sum[SIZE], tmp[SIZE], next[SIZE], tot, len;
	int cmp(int x, int y) {
		if (tmp[x] != tmp[y]) return tmp[x] < tmp[y];
		return tmp[x + len] < tmp[y + len];
	}
	void DA(const char s[], int n, int m = 128){
		for (int i = 0; i < m; i++) sum[i] = 0;
		for (int i = 0; i <= n; i++) sum[rank[i] = s[i]]++;
		for (int i = 1; i < m; i++) sum[i] += sum[i - 1];
		for (int i = n; i >= 0; i--) sa[--sum[rank[i]]] = i;
		for (len = tot = 1; tot <= n; len *= 2, m = tot) {
			for (int i = tot = 0; i <= n; i++) tmp[i] = rank[i];
			for (int i = n; i + len > n; i--) next[tot++] = i;
			for (int i = 0; i <= n; i++) if (sa[i] >= len) next[tot++] = sa[i] - len;
			for (int i = 0; i < m; i++) sum[i] = 0;
			for (int i = 0; i <= n; i++) sum[rank[next[i]]]++;
			for (int i = 1; i < m; i++) sum[i] += sum[i - 1];
			for (int i = n; i >= 0; i--) sa[--sum[rank[next[i]]]] = next[i];
			for (int i = rank[sa[0]] = 0; i < n; i++) 
				rank[sa[i + 1]] = rank[sa[i]] + cmp(sa[i], sa[i + 1]);
			tot = rank[sa[n]] + 1;
		}
		for (int i = len = lcp[sa[0]] = 0; i < n; i++){
			if (len) len--;
			while(s[i + len] == s[sa[rank[i] - 1] + len]) len++;
			lcp[rank[i]] = len;
		}
	}
}SA;


int main(){

	freopen("binary.in","r",stdin);	
	freopen("binary.out","w",stdout);
	while (scanf("%d",&n)!=EOF){
	
	string ans = "";
	for(int i=1;i<=n;i++)
		scanf("%d",&a[i]),oppo[a[i]]=i;
	int lag=0,pt=n;
	if (oppo[n]!=1){
		color[n]=1;
		lag=1;
		ans+='1';
	}
		else{
			while(oppo[pt]==lag+1 && pt>=1){
				ans+='0';
				
				lag++;
				pt--;
			}
		}
	
	for(int i=n-lag;i>0;i--){
		int now=oppo[i];
		int last=oppo[i+1];
		if(now<last){
			color[i]=0;
			ans+='0';
		}
		else{
			color[i]=1;
			ans+='1';
			}
	}
	
	reverse(ans.begin(),ans.end());
	
	SA.DA(ans.c_str(),n);
	
	int bo=1;
	for (int i=1;i<=n;i++)
		if (SA.sa[i]+1!=a[i]) bo=0;
	//for (int i=1;i<=n;i++) printf("%d ",a[i]);
	if (bo) cout << ans<<endl;
		else printf("Error\n");
		
	//for (int i=1;i<=n;i++) printf("%d ",SA.sa[i]+1);
	//printf("\n");
	}
	
	return 0;
}
