#include <bits/stdc++.h>
using namespace std;
const long long inf = 1000000000, N = 100000, MAX = 100000, mod = 1000000009;
pair<long long, long long> merge(pair<long long, long long> a,
                                 pair<long long, long long> b) {
  if (a.first == b.first)
    return make_pair(a.first, (a.second + b.second) % mod);
  else if (a.first < b.first)
    return b;
  else
    return a;
}
struct SegmentTree {
  pair<long long, long long> ST[4 * MAX + 5];
  pair<long long, long long> update(long long i, long long b, long long s,
                                    long long x, pair<long long, long long> t) {
    if (x < b || x > s) return ST[i];
    if (b == s) {
      return ST[i] = merge(ST[i], t);
    }
    long long o = (b + s) / 2;
    return ST[i] = merge(update(2 * i, b, o, x, t),
                         update(2 * i + 1, o + 1, s, x, t));
  }
  pair<long long, long long> query(long long i, long long b, long long s,
                                   long long x, long long y) {
    if (x > s || y < b) return make_pair(0, 0);
    if (x <= b && y >= s) return ST[i];
    long long o = (b + s) / 2;
    return merge(query(2 * i, b, o, x, y), query(2 * i + 1, o + 1, s, x, y));
  }
};
SegmentTree T1, T2;
long long n, a[N + 5];
pair<long long, long long> dp1[N + 5], dp2[N + 5];
int main() {
  pair<long long, long long> lis = make_pair(0, 0);
  scanf("%lld", &n);
  for (long long i = 1; i <= n; i++) {
    scanf("%lld", a + i);
  }
  for (long long i = n; i >= 1; i--) {
    dp1[i] = merge(make_pair(0, 1), T1.query(1, 1, MAX, a[i] + 1, MAX));
    dp1[i].first++;
    T1.update(1, 1, MAX, a[i], dp1[i]);
    lis = merge(lis, dp1[i]);
  }
  for (long long i = 1; i <= n; i++) {
    dp2[i] = merge(make_pair(0, 1), T2.query(1, 1, MAX, 1, a[i] - 1));
    dp2[i].first++;
    T2.update(1, 1, MAX, a[i], dp2[i]);
  }
  for (long long i = 1; i <= n; i++) {
    if (dp1[i].first + dp2[i].first - 1 < lis.first)
      printf("1");
    else if ((dp1[i].second * dp2[i].second) % mod == lis.second)
      printf("3");
    else
      printf("2");
  }
  puts("");
  return 0;
}
