#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 10;
const int INF = 0x7fffffff;
int n, len, a[maxn], b[maxn];
int dp[maxn];
int dp_1[maxn], dp_2[maxn], mp[maxn];
int binery_search(int x) {
  int l = 0, r = n - 1;
  while (l <= r) {
    int mid = l + (r - l) / 2;
    if (dp[mid] <= x)
      r = mid - 1;
    else if (dp[mid] > x)
      l = mid + 1;
  }
  return l;
}
int main() {
  while (~scanf("%d", &n)) {
    memset(mp, 0, sizeof(mp));
    fill(dp, dp + n, INF);
    for (int i = 0; i < n; ++i) {
      scanf("%d", a + i);
      b[n - i - 1] = a[i];
      int loc = lower_bound(dp, dp + n, a[i]) - dp;
      dp[loc] = a[i];
      dp_1[i] = loc + 1;
    }
    len = lower_bound(dp, dp + n, INF) - dp;
    memset(dp, 0, sizeof(dp));
    for (int i = 0; i < n; ++i) {
      int loc = binery_search(b[i]);
      dp[loc] = b[i];
      dp_2[n - i - 1] = loc + 1;
    }
    for (int i = 0; i < n; ++i) {
      if (dp_1[i] + dp_2[i] - 1 == len) mp[dp_1[i]]++;
    }
    for (int i = 0; i < n; ++i) {
      if (dp_1[i] + dp_2[i] - 1 == len) {
        if (mp[dp_1[i]] > 1)
          putchar('2');
        else
          putchar('3');
      } else
        putchar('1');
    }
    puts("");
  }
  return 0;
}
