#include <bits/stdc++.h>
using namespace std;
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
const long long maxn = 2e5 + 10, N = 2e6, SQ = 320, base = 800287,
                mod = 1e9 + 7, INF = 1e9 + 10, lg = 22;
const double eps = 1e-4;
long long n, a[maxn], L[maxn], R[maxn], val[maxn];
long long dp1[maxn], dp2[maxn], cnt[maxn];
void find_LIS() {
  fill(dp1, dp1 + maxn, INF);
  dp1[0] = -INF;
  for (long long i = 0; i < n; ++i) {
    long long s = 0, e = n + 1;
    while (s < e - 1) {
      if (dp1[(s + e) / 2] < a[i]) {
        s = (s + e) / 2;
      } else {
        e = (s + e) / 2;
      }
    }
    dp1[s + 1] = a[i];
    R[i] = s + 1;
  }
}
void find_reverse_LIS() {
  fill(dp2, dp2 + maxn, -INF);
  dp2[0] = INF;
  for (long long i = n - 1; i >= 0; --i) {
    long long s = 0, e = n + 1;
    while (s < e - 1) {
      if (dp2[(s + e) / 2] > a[i]) {
        s = (s + e) / 2;
      } else {
        e = (s + e) / 2;
      }
    }
    dp2[s + 1] = a[i];
    L[i] = s + 1;
  }
}
int32_t main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a[i];
  }
  find_LIS();
  find_reverse_LIS();
  long long lis = 0;
  for (long long i = 0; i < n; ++i) {
    lis = max(lis, R[i]);
    val[i] = L[i] + R[i] - 1;
  }
  for (long long i = 0; i < n; ++i) {
    if (val[i] == lis) {
      cnt[R[i]]++;
    }
  }
  for (long long i = 0; i < n; ++i) {
    if (val[i] < lis) {
      cout << 1;
    } else {
      cout << (cnt[R[i]] > 1 ? 2 : 3);
    }
  }
  cout << '\n';
}
