#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 10;
int a[MAXN], dpF[MAXN], dpT[MAXN], cnt[MAXN];
int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> a[i];
  vector<int> lis;
  lis.clear();
  for (int i = 0; i < n; i++) {
    int plc =
        lower_bound(lis.begin(), lis.end(), a[i], less<int>()) - lis.begin();
    dpT[i] = plc;
    if (plc == lis.size()) lis.push_back(a[i]);
    lis[plc] = a[i];
  }
  lis.clear();
  for (int i = n - 1; i >= 0; i--) {
    int plc =
        lower_bound(lis.begin(), lis.end(), a[i], greater<int>()) - lis.begin();
    dpF[i] = plc + 1;
    if (plc == lis.size()) lis.push_back(a[i]);
    lis[plc] = a[i];
  }
  int ansLen = 0;
  for (int i = 0; i < n; i++) ansLen = max(ansLen, dpT[i] + dpF[i]);
  for (int i = 0; i < n; i++)
    if (ansLen == dpT[i] + dpF[i]) cnt[dpT[i]]++;
  for (int i = 0; i < n; i++) {
    if (ansLen > dpT[i] + dpF[i])
      cout << 1;
    else if (cnt[dpT[i]] > 1)
      cout << 2;
    else
      cout << 3;
  }
  cout << endl;
  return 0;
}
