#include <bits/stdc++.h>
using namespace std;
const int mN = 1e5 + 100;
int n, arr[mN], dpl[mN], dpr[mN], cnt[mN], mx;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; ++i) scanf("%d", &arr[i]);
  vector<int> vec(mN, 1e9);
  vec[0] = -1e9;
  for (int i = 0; i < n; ++i) {
    int j = lower_bound(vec.begin(), vec.end(), arr[i]) - vec.begin();
    dpl[i] = j;
    vec[j] = arr[i];
  }
  for (int i = 0; i < mN; ++i) vec[i] = -1e9;
  vec[0] = 1e9;
  for (int i = n - 1; i >= 0; i--) {
    int j = lower_bound(vec.begin(), vec.end(), arr[i], greater<int>()) -
            vec.begin();
    dpr[i] = j;
    vec[j] = arr[i];
    mx = max(mx, dpr[i] + dpl[i] - 1);
  }
  for (int i = 0; i < n; ++i)
    if (dpr[i] + dpl[i] - 1 == mx) ++cnt[dpr[i]];
  for (int i = 0; i < n; ++i) {
    if (dpr[i] + dpl[i] - 1 < mx)
      printf("1");
    else if (cnt[dpr[i]] > 1)
      printf("2");
    else
      printf("3");
  }
};
