#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, m = 1, a[100009];
  int b[100009], c[100009][2];
  cin >> n;
  for (int i = 0; i < n; i++) {
    scanf("%d", a + i);
  }
  memset(b, 0, sizeof(b)), memset(c, 0, sizeof(c));
  c[0][0] = a[n - 1], c[0][1] = 1;
  b[n - 1] = 1;
  int st = 0, en = 0;
  for (int i = n - 2; i >= 0; i--) {
    if (a[i] >= c[0][0]) {
      c[0][0] = a[i];
      b[i] = c[0][1];
    } else {
      int sst = st, enn = en;
      while (sst <= enn) {
        int mid = (sst + enn) / 2;
        if (c[mid][0] <= a[i])
          enn = mid - 1;
        else
          sst = mid + 1;
      }
      c[sst][0] = a[i], c[sst][1] = c[sst - 1][1] + 1;
      b[i] = c[sst][1];
      en = max(en, sst);
    }
  }
  memset(c, 0, sizeof(c));
  c[0][0] = a[0], c[0][1] = 1;
  b[0]++;
  m = b[0];
  st = 0, en = 0;
  for (int i = 1; i < n; i++) {
    if (a[i] <= c[0][0]) {
      c[0][0] = a[i];
      b[i] += c[0][1];
    } else {
      int sst = st, enn = en;
      while (sst <= enn) {
        int mid = (sst + enn) / 2;
        if (c[mid][0] >= a[i])
          enn = mid - 1;
        else
          sst = mid + 1;
      }
      c[sst][0] = a[i], c[sst][1] = c[sst - 1][1] + 1;
      b[i] += c[sst][1];
      en = max(en, sst);
    }
    if (b[i] > m) m = b[i];
  }
  int d[100009], mm = 0;
  for (int i = 0; i < n; i++) {
    if (b[i] == m) {
      if (mm >= a[i]) {
        d[i] = 2;
      }
      mm = max(mm, a[i]);
    } else
      d[i] = 1;
  }
  mm = 10000000;
  for (int i = n - 1; i >= 0; i--) {
    if (b[i] == m) {
      if (mm <= a[i]) {
        d[i] = 2;
      }
      mm = min(mm, a[i]);
    }
  }
  for (int i = 0; i < n; i++) {
    if (d[i] == 0)
      cout << 3;
    else
      cout << d[i];
  }
  cout << endl;
  return 0;
}
