#include <bits/stdc++.h>
using namespace std;
const int N = 100100;
int n, a[N], lx[N], rx[N];
vector<int> comb[N];
char ans[N];
struct bit {
  int ft[N];
  void upd(int x, int v) {
    for (; x < N; x += (x & -x)) ft[x] = max(ft[x], v);
  }
  int rmq(int x) {
    int ret = 0;
    for (; x > 0; x -= (x & -x)) ret = max(ret, ft[x]);
    return ret;
  }
  void clear() { memset(ft, 0, sizeof ft); };
} dp;
void bld(int A[], int L[]) {
  dp.clear();
  for (int i = 1; i <= n; i++) {
    L[i] = dp.rmq(A[i] - 1);
    dp.upd(A[i], L[i] + 1);
  }
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> a[i];
  bld(a, lx);
  reverse(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) a[i] = 1 + 1e5 - a[i];
  bld(a, rx);
  reverse(rx + 1, rx + 1 + n);
  reverse(a + 1, a + 1 + n);
  for (int i = 1; i <= n; i++) a[i] = 1 + 1e5 - a[i];
  int L = 1 + *max_element(lx + 1, lx + 1 + n);
  memset(ans, '1', sizeof ans);
  for (int i = 1; i <= n; i++) {
    if (lx[i] + rx[i] == L - 1) {
      ans[i] = '2';
      comb[lx[i]].push_back(i);
    }
  }
  for (int i = 0; i < n; i++) {
    if (comb[i].size() == 1) {
      ans[comb[i][0]] = '3';
    }
  }
  ans[n + 1] = 0;
  cout << 1 + ans << '\n';
  return 0;
}
