#include <bits/stdc++.h>
using namespace std;
const int Max = 1e5 + 9, inf = 1e9;
vector<int> S;
int A[Max], dp[2][Max], T[Max], Ans[Max];
int main() {
  int n, mx = -1;
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> A[i];
  S.push_back(-inf);
  for (int i = 1; i <= n; i++) {
    vector<int>::iterator it = lower_bound(S.begin(), S.end(), A[i]);
    if (it == S.end())
      S.push_back(A[i]), dp[0][i] = S.size() - 1;
    else
      S[it - S.begin()] = A[i], dp[0][i] = it - S.begin();
    A[i] *= -1;
  }
  mx = S.size() - 1;
  S.clear();
  S.push_back(-inf);
  for (int i = n; i >= 1; i--) {
    vector<int>::iterator it = lower_bound(S.begin(), S.end(), A[i]);
    if (it == S.end())
      S.push_back(A[i]), dp[1][i] = S.size() - 1;
    else
      S[it - S.begin()] = A[i], dp[1][i] = it - S.begin();
  }
  for (int i = 1; i <= n; i++) {
    if (dp[0][i] + dp[1][i] - 1 < mx)
      Ans[i] = 1;
    else
      T[dp[0][i]]++;
  }
  for (int i = 1; i <= n; i++)
    cout << ((Ans[i] == 1) ? 1 : ((T[dp[0][i]] == 1) ? 3 : 2));
}
