#include <bits/stdc++.h>
using namespace std;
const int maxn = 100050, maxa = maxn;
int n, a[maxn], ans[maxn];
int f1[maxn], f2[maxn], len;
int b[maxn];
int cnt[maxn];
int main() {
  int i, j;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) scanf("%d", &a[i]);
  memset(b, 0x3f, sizeof(b));
  f1[0] = b[0] = 0;
  for (i = 1; i <= n; i++) {
    j = lower_bound(b, b + maxn, a[i]) - b;
    b[j] = a[i];
    len = max(len, f1[i] = j);
  }
  memset(b, 0x3f, sizeof(b));
  f2[n + 1] = b[0] = 0;
  for (i = n; i; i--) {
    j = lower_bound(b, b + maxn, maxa - a[i]) - b;
    b[j] = maxa - a[i];
    f2[i] = j;
  }
  for (i = 1; i <= n; i++)
    if (f1[i] + f2[i] == len + 1)
      cnt[f1[i]]++;
    else
      ans[i] = 1;
  for (i = 1; i <= n; i++)
    if (!ans[i]) ans[i] = (cnt[f1[i]] == 1 ? 3 : 2);
  for (i = 1; i <= n; i++) printf("%d", ans[i]);
  printf("\n");
  return 0;
}
