#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 66.6;
int arr[MAXN];
int lis[MAXN];
int dp[2][MAXN];
int mark[2][MAXN];
int zz = 0;
void LIS(int n, int &ans) {
  ans = 1;
  fill(lis, lis + n, 0);
  lis[0] = arr[0];
  for (int i = 1; i < n; i++) {
    if (arr[i] < lis[0]) {
      lis[0] = arr[i];
      dp[zz][i] = 0;
    } else if (arr[i] > lis[ans - 1]) {
      lis[ans++] = arr[i];
      dp[zz][i] = ans - 1;
    } else {
      int *w = lower_bound(lis, lis + ans, arr[i]);
      *w = arr[i];
      dp[zz][i] = w - lis;
    }
  }
  zz++;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) cin >> arr[i];
  int ans1, ans2;
  LIS(n, ans1);
  for (int i = 0; i < ceil(n * 1.0 / 2); i++) {
    arr[i] = -arr[i];
    arr[n - i - 1] = -arr[n - i - 1];
    swap(arr[i], arr[n - i - 1]);
  }
  if (n % 2) arr[n / 2] *= -1;
  LIS(n, ans2);
  for (int i = 0; i < n; i++)
    if (1 + dp[0][i] + dp[1][n - i - 1] == ans1) mark[0][dp[0][i]]++;
  for (int i = 0; i < n; i++) {
    if (1 + dp[0][i] + dp[1][n - i - 1] == ans1) {
      if (mark[0][dp[0][i]] < 2)
        cout << 3;
      else
        cout << 2;
    } else
      cout << 1;
  }
  cout << endl;
  return 0;
}
