#include <bits/stdc++.h>
using namespace std;
long long n, i, j, a[222222], p[222222][7];
bool dp[222222][7];
bool f;
vector<long long> st;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (i = 1; i <= n; i++) cin >> a[i];
  for (long long o = 1; o <= 5; o++) {
    memset(dp, 0, sizeof(dp));
    dp[1][o] = 1;
    for (i = 1; i <= n - 1; i++)
      for (j = 1; j <= 5; j++)
        if (dp[i][j]) {
          if (a[i] < a[i + 1]) {
            for (long long x = j + 1; x <= 5; x++) {
              dp[i + 1][x] = 1;
              p[i + 1][x] = j;
            }
          } else if (a[i] > a[i + 1]) {
            for (long long x = 1; x <= j - 1; x++) {
              dp[i + 1][x] = 1;
              p[i + 1][x] = j;
            }
          } else if (a[i] == a[i + 1]) {
            for (long long x = 1; x <= 5; x++)
              if (x != j) {
                dp[i + 1][x] = 1;
                p[i + 1][x] = j;
              }
          }
        }
    for (long long oo = 1; oo <= 5; oo++)
      if (dp[n][oo]) {
        f = 1;
        j = oo;
        st.clear();
        st.push_back(j);
        for (i = n; i >= 2; i--) {
          j = p[i][j];
          if (j == 0) {
            f = 0;
            break;
          }
          st.push_back(j);
        }
        if (!f) continue;
        break;
      }
    if (f) {
      for (i = st.size() - 1; i >= 0; i--) cout << st[i] << " ";
      cout << "\n";
      return 0;
    }
  }
  cout << -1 << "\n";
  return 0;
}
