#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 15;
int n, a[MAXN], b[MAXN], inf = 1e9 + 19, pos, st[MAXN], en[MAXN], LIS,
                         cnt[MAXN];
void fil() {
  b[0] = -inf;
  for (int i = 1; i < MAXN; i++) b[i] = inf;
}
int bs(int x) {
  int s = 0, e = 1e5 + 10;
  while (s + 1 < e) {
    int mid = (s + e) / 2;
    if (b[mid] < x)
      s = mid;
    else
      e = mid;
  }
  if (b[s] >= x) {
    b[s] = x;
    return s;
  } else {
    b[e] = x;
    return e;
  }
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  fil();
  for (int i = 0; i < n; i++) {
    pos = bs(a[i]);
    st[i] = pos;
  }
  for (int i = 0; i <= n; i++)
    if (b[i] != inf) LIS = i;
  fil();
  for (int i = n - 1; i >= 0; i--) {
    pos = bs(-a[i]);
    en[i] = pos;
  }
  for (int i = 0; i < n; i++)
    if (st[i] + en[i] - 1 == LIS) cnt[st[i]]++;
  for (int i = 0; i < n; i++) {
    if (st[i] + en[i] - 1 != LIS)
      cout << 1;
    else if (cnt[st[i]] == 1)
      cout << 3;
    else
      cout << 2;
  }
}
